Web sites have become much more than just text, images, and links to other pages. Internet users expect greatness from a Web site and the bar is constantly being raised by Web sites and companies such as Facebook, Google, Microsoft , Twitter, and Foursquare, to name a few. The technology is constantly changing, and using jQuery helps you keep up with the fast pace. jQuery is a library that promotes rapid development of Web sites or applications and allows you to focus on user interaction and interface design without having to write long, bloated code.
Writing jQuery is easier than writing JavaScript code because you are following an API. If you are proficient in writing HTML and CSS, you can understand and write jQuery because most jQuery functionality is based on interactivity within the HTML and CSS.
- Open Source
JavaScript libraries are supported by the open source community and are well tested and updated. The open source community a huge support network. Web designers and developers are continually creating tutorials, books, and plug-ins to help and extend the jQuery library.
- Great Documentation
By far, one of the greatest benefi ts of jQuery is its documentation, which is what makes a great library. The team behind jQuery has spent a great deal of their time documenting how the library works and how to navigate around their API. The jQuery documentation site has tutorials complete with code examples, plus a huge community of supporters across the Web.
The community of developers and programmers that has created the jQuery library are constantly improving and releasing new versions. jQuery was first released 2006 as v1.0. Since then, the code has been updated many times, which brings us to the current release, v1.7.1.
jQuery is continuously being improved, which is one of the reasons it has become so popular. Libraries that aren't updated as oft en are not as popular. As updates occur, the documentation is updated for methods that have become deprecated (slated for removal in the next release) and to ensure that the library will be backwardcompatible — that is, that it works with older versions. When a library is updated to a new version, the process of upgrading is painless — you just drop the new JavaScript library on your server. In addition, you should usually look over the changelog, a section that outlines
each release and the changes that have been made to the library, to see if any methods you are using have become deprecated.
jQuery is released under the MIT License or the GNU General Public License (GPL), version 2. The is basically means that it's free, and as long as you give credit to the author within the jQuery plug-in itself, you are free to use the code as you wish.
- Same JavaScript with Less Code
jQuery is JavaScript: Everything you can do in JavaScript, you can also do in jQuery. The possibilities are endless. What I love about jQuery is that it gives you a base you can build on, but you're not limited by what jQuery offers. When you're using jQuery, you have three options when coding:
+ Use the extensive jQuery API
+ Use or create a jQuery plug-in
+ Write regular JavaScript
Another attractive benefit of jQuery is the brevity of the code. If I want to change the background color in plain JavaScript, the code looks like this:
document.getElementById('mydiv').style.backgroundColor = 'red';
By using the powerful selection engine, jQuery needs only one shorter line to achieve the same outcome:
$('#mydiv').css('background-color','red');
The syntax is easier to understand than JavaScript and was created with Web designers in mind. When you compare this syntax to other libraries such as Prototype or YUI, you can see why jQuery has become the choice for many Web professionals. The selector engine is the most prominent and loved feature of the jQuery library. It allows you to use CSS2 selectors, which makes it incredibly easy for Web designers with CSS knowledge to pick up.
- Chaining
One of jQuery's greatest features is chaining, which allows you to chain multiple methods one after the other. This helps to keep your amount of code smaller and therefore improves the speed with which your jQuery code is retrieved from the Web server and executed. Here's an example of jQuery code that uses chaining:
$('#foo').addClass('active').prev().removeClass('active');
Here's an example that doesn't use chaining:
$('#foo').addClass('active');
$('#foo').next().removeClass('.active');
The example that uses chaining is a cleaner and more concise way to write jQuery.
Read More:
The Advantages of jQuery - Part 2
0 comments:
Post a Comment