This question is just out of curiosity. I want to know how jquery.click () works behind the scenes.
For example, if I create a button:
<input type="button" id="myButton" value="Click me!" />
Then I have the following jquery code:
$('#myButton').click( function() {
alert("I have been clicked.");
});
How does jquery do this so that my function is called when a button is clicked?
At first I thought it would add an attribute onClick=""to the button tag, but when I checked the page with Firebug, I just saw:
<input type="button" id="myButton" value="Click me!" />
So what does jquery do behind the scenes?
Anton source
share