I need to understand how the second function is able to gain access to the numberToShow attribute of the first function. I have no clue how it does that because none of my html tags carries that attribute. I am confused. It would be greatly appreciated. Thank you.
EDIT: Nevermind. I believe I figured it out. The following line of code:
$(id).attr('numberToShow', numberToShow);
from the first function creates the attribute and then the second function or any other function can retrieve it. I figured it out because I found out that in jQuery, any attributes (including invalid attributes) can be added to elements for later use. That is actually a very handy functionality. I hope that they keep it. Thank you anyway. :)
Question
winlonghorn
I was wondering if someone could help me to understand the following code:
http://pastebin.com/mvQ9y6mZ
I need to understand how the second function is able to gain access to the numberToShow attribute of the first function. I have no clue how it does that because none of my html tags carries that attribute. I am confused. It would be greatly appreciated. Thank you.
EDIT: Nevermind. I believe I figured it out. The following line of code:
$(id).attr('numberToShow', numberToShow);from the first function creates the attribute and then the second function or any other function can retrieve it. I figured it out because I found out that in jQuery, any attributes (including invalid attributes) can be added to elements for later use. That is actually a very handy functionality. I hope that they keep it. Thank you anyway. :)
Link to comment
Share on other sites
2 answers to this question
Recommended Posts