1. What is jQuery?
jQuery is a library that makes it quicker and easier to build JavaScript webpages and web apps. Often with jQuery you can write a single line of code to achieve what would have taken 10-20 lines of regular JavaScript code.
jQuery is itself written in JavaScript, and comes in the form of a single .js file that you link to from your webpage. Your JavaScript code then accesses the library by calling various jQuery functions.
2. How does it help us as developers?
jQuery makes it easy to write powerful JavaScript apps and create eye-catching animated effects rivalling those of Flash movies. Amongst other things, jQuery is great for:
-
Adding animated effects to elements. jQuery lets you easily add effects such as fading in/out, sliding in/out, and expanding/contracting.
-
Making XML (Ajax) requests. These use JavaScript to request additional data from the Web server without having to reload the page.
-
Manipulating the DOM . You can easily add, remove, and reorder content in the Web page using just a couple of lines of code.
-
Creating image slideshows. You can use jQuery effects to build nice animated slideshows and lightboxes.
-
Making drop-down menus. jQuery makes it easy to create multi-level dropdowns with animations.
-
Creating drag-and-drop interfaces. Use jQuery to build a page with elements that can be repositioned or reordered simply by dragging and dropping.
-
Adding power to forms. With jQuery you can easily add complex client-side form validation, create auto-complete Ajax text fields that pull data from a server-side database, and so on.
3. Why do we have 2 version of jQuery - minified and uncompressed?
-
The uncompressed .js file is easy to read and modify, but itās around 160kb in size (at the time of writing).
-
The minified .js file has all comments, whitespace, and other unnecessary characters removed from the file, squeezing the whole library into a mere 23kb. Although you canāt easily read the code, this is the version youāll want to place on your site, as itās much quicker for visitors to download.