What is the difference between jQuery 1.x and 2.x If you want to support IE6/7/8, then use jQuery 1.x where as if you don't have the need to support IE6/7/8 then use jQuery 2.x. jQuery 2.x is smaller in size than jQuery 1.x.
Example : Adding a click event handler for a button control using jQuery. With jQuery we have less code to achieve the same thing.We don't have to worry about cross-browser issues, as all this is taken care by jQuery.
Please Note : If you want this example to work in IE 6/7/8, then use jQuery 1.x. If there is no need to support IE 6/7/8, then use jQuery 2.x.
Points to remember : 1. ready() function ensures that the DOM is fully loaded. 2. $ is a shortcut for jQuery. 3. All three of the following syntaxes are equivalent: $( document ).ready( handler ) $().ready( handler ) (this is not recommended) $( handler )