jQuery Advantages and Disadvantages

What is jQuery?
jQuery is basically a JavaScript library and it was designed to make the client-side scripting of HTML more simple. The person responsible for its birth is John Resig at BarCamp NYC in 2006.
It is an open-source software and dual-licensed by MIT License and the GNU General Public License. Version 2. jQuery has received an enormous success and it is used by 31% of the 10,000 most visited websites over internet. This makes jQuery the most popular JavaScript library being used today.
jQuery Advantages and Disadvantages
Introduction
The best thing about it is the code is very compact and easy to use. It works grate for,

  • Handling Events
  • Selecting DOM Elements
  • Developing Ajax Programs
  • Creating Animations helps designers

jQuery is excellent for developing dynamic web pages and page elements. It allows the developers to create plugins that would work on top of the JavaScript library. These capabilities enable the designers to make abstractions for low-level interactions and animations, and also to create high-level widgets.

Advantages:
Simplicity
It can be easly added to HTML page as below.

<script src="jquery.js" type="text/javascript"></script> <script type="text/javascript">// <![CDATA[
your code...
// ]]></script>

Download jQuert from here docs.jquery.com/Downloading_jQuery

Implementation
There are two ways to do this,

  • Via the $ function, which can be called the default work method for the jQuery object. $ functions, it returns a jQuery object.
  • Via $.-prefixed functions. These are utility functions which do not work on the jQuery object per se.

Typically, access and manipulation with multiple DOM nodes begins with the $ function being called with a CSS selector string or HTML elements ID, which results in a jQuery object referencing matching elements in the HTML page.

jQuery Plugins
jQuery us well structured javascript framework. Developer can develope their own addons, as well as jQuery provides millons of plugins, free on internet for ajax helper, animation, element manipulation, drag drop elements, cookies and many more. You can download Plugins from jQuery’s Site plugins.jquery.com

Effects & Animation
Another fancy thing about jQuery can create effects very easly with very little code. See Example code below for fade out effect:

<!--
p { font-size:150%; cursor:pointer; }
-->
<script src="http://code.jquery.com/jquery-1.4.4.js"></script> click here to see the magic of jQuery     <script type="text/javascript">// <![CDATA[
  $("p").click(function () {
  $("p").fadeOut("slow");
  });
// ]]></script>

Now from above code’s O/P, when you click on link, it will slowly disapear. Click here api.jquery.com/fadeOut/ for more tutorials

Disadvantages:
There are not much disadvantages of jQuery, in fact there are none ;), so use it in your site :)

Use of Selector
jQuery always crosses through all the elements each time you use selectors. This makes the application dull.
Solution: Cache your selections with some variable(s) if you are using the same selection at multiple places. And if you are not selecting an element more than once, just don’t cache selection by assigning it to some variable.

Conclusion

  • Simply, jQuery is the best You can easly perform various tasks such as:
  • drop down menus
  • drag and drop elements
  • animations
  • form validation
  • ajax helper
  • ui elements
  • Photo galleries
  • slide shows

All this can be done with little coding, it sync wells with PHP, .Net and most of the server side languages, it is pretty handy source evenn Microsoft has added it into its framework.

Feel Free to comment on this!

You might like:

Leave a Reply