The click() function does not change any DOM attributes It adds a listener for that particular jQuery element The same goes for change(), .keyup() etcetera.
The click() function does not change any DOM attributes. It adds a listener for that particular jQuery element. The same goes for .change(), .keyup(), ... etcetera.
That's what I thought. Good ol' jQuery. – NeXXeuS Sep 8 at 21:14 1 Just as a side note, you can see the events attached to a particular element by doing $('yourelement').data().
Under events you can see the events it's listening for. – Interstellar_Coder Sep 8 at 21:18.
It does not modify the element. JQuery() — which can also be written as $() — searches through the DOM for any elements that match the provided selector and creates a new jQuery object that references these elements.
Looking at the jQuery 1.6.2 source: $("myElement"). Click(...) calls: $("myElement"). Bind('click', ...) which then calls: jQuery.event.
Add(...) which ultimately does either elem. AddEventListener(...) or elem. AttachEvent(...) So, we can say conclusively that it is not setting the onclick attribute (which is as we would expect since addEventListener is more extensible).
BUT, when I step through the .click() function, deep inside, an attribute is being added to the DOM object. It's related to jQuery's data function and it in this piece of code in jQuery's data function which is called from event. Add(...).
It looks like it's some sort of guid identifier that jQuery uses to keep track of which object is which without keeping a DOM reference (which can lead to memory leaks). The code that adds that attribute is here: if (!id ) { // Only DOM nodes need a new unique ID for each element since their data // ends up in the global cache if ( isNode ) { elem jQuery. Expando = id = ++jQuery.
Uuid; } else { id = jQuery. Expando; } } So, in conclusion, jQuery is not touched the . Onclick attribute, but it is setting at least one other attribute on the DOM object when setting the first event handler.
Why would you expect it to set an attribute?! – Neal Sep 8 at 21:22 You misunderstood my meaning (which was poorly written and I have now changed). I was not expecting it to set the onclick attribute.
But, as it turns out, it does set a different attribute on the DOM object. – jfriend00 Sep 8 at 21:32.
Click(...) calls: $("myElement"). Which then calls: jQuery.event. Which ultimately does either elem.
AddEventListener(...) or elem. Expando = id = ++jQuery. Id = jQuery.
The click() function does not change any DOM attributes.
I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.