jQuery - " ", . jQuery? .
function addEventToElements(tagname,handler) {
var elems = document.getElementsByTagName(tagname);
for(var i = 0, l = elems.length; i<l; i++) {
elems[i].addEventListener('click',handler);
}
}
:
addEventToElements('p',function() {alert("click succeeded");});
, jQuery.
... , jQuery , . , ( , attachEvent
onEventName
), , jQuery, ;)