Im learning jQuery and when I read about $('.className').bind('click',function(){})
method one doubt arose.
Does this method attach my event handler to each instance of className
in the DOM? If so would it be a good approach -- like attaching an event handler to lot of instances on a page is an overhead right?
Or is it making use of event delegation -- say, the handler would be bound to some common parent which would make use of e.target equalTo className
and execute the click event, so that handler is bound to only one DOM element?
Please help me understand. Thanks.
One more doubt. If I do attach an event to each and every dom element where does the overload come into effect? Will it cause extra load to the browser while execution or would it make the dom heavy (by heavy I mean, difficulty in parsing dom)?