Advantages of jQuery
1. It’s lightweight, easy and fast.
2. Write less but do more.
3. Cross Browser Compatibility.
5. Easy and Light-weight Ajax Application.
6. Availability of various plug-in’s.
7. You can extend it.
8. We can use CDN (Content Distribution Network) for internet site.
9. Microsoft and Intellisense support in Visual Studio 2008.
10. Easy Integration with ASP.Net Ajax projects.
Moving forward, we will look deeply into the above advantages with examples.
1. It’s lightweight, easy and fast
2. Write less but do more
The main advantage of jQuery library is, we can do various complex client side operations with very less code. This is because of various selector expressions support, chaining mechanism and other similar features of jQuery which makes the complex DOM manipulation lot easier.
The above equivalent in jQuery will be,
To select all the rows in a table and setting a background color,
$('#table1 > tbody > tr').css("background-color", "Red");
Refer jQuery selector documentation to know more on jQuery selectors.
Check All Checkboxes in GridView using jQuery – jQuery version and less code.
The other advantage of jQuery is using the chaining mechanism which will help us to reduce the code.
Refer the below code to understand better,
The above code selects a TextBox control with ID txtName, then applies css style and then set its text as “Test”.
3. Cross Browser Compatibility
The jQuery code we write is compatible with all the browsers and hence it prevents the need to write separate client side code for different browsers. Remember to set the css properties that are cross-browser compatible when using jQuery for cross browser compatibility.
jQuery library enables us to separate the client side scripts from the HTML mark-ups. This is possible because of $(document).ready() function of jQuery.
<input id="btnSubmit" onclick="javscript:Save()" type="button" value="button" />
The above code can written as,
5. Easy and Light-weight Ajax Application
One of biggest advantages of using jQuery library is developing light weight Ajax application in ASP.Net with JSON support. With jQuery library we can prevent the bulky ASP.Net AJAX’s UpdatePanel control for Ajax communications.
Refer my articles on codedigest.com to know more,
6. Availability of various plug-in’s
There are various free plug-in’s available on the internet which we can use in our projects. For example, jQuery tabs, jTemplate, etc.
Refer the plug-in’s directory here. Since, the jQuery usage is becoming high day by day there are already lots of plug-in’s available online which we can re-use.
7. You can extend it
It is also possible to extend existing functionality provided by jQuery library.
Refer the below post which talks about jQuery Custom Selectors.
8. We can use CDN (Content Distribution Network) for internet site
If our site is hosted on internet, then we can start using the jQuery library hosted by Google CDN, Content Distribution Network.
Read Using the JQuery Library hosted by Google CDN (Content Distribution Network) in ASP.Net Applications to know more.
9. Microsoft and Intellisense support in Visual Studio 2008
Refer the below 2 FAQ’s to know more,
10. Easy Integration with ASP.Net Ajax projects
jQuery library can be easily integrated with ASP.Net Ajax applications. Remember the ready event will not fire for an asynchronous postback caused from UpdatePanel control. The ASP.Net AJAX equivalent of ready() function is endRequest event.
var manager = Sys.WebForms.PageRequestManager.getInstance();
function endRequest(sender, args)
//Do all what you want to do in jQuery ready function