jQuery is not a language, but it is a well written JavaScript code.
As quoted on official jQuery website, "it is a fast and concise
JavaScript Library that simplifies HTML document traversing, event
handling, animating, and Ajax interactions for rapid web development."
In order to work with jQuery, you should be aware of the basics of JavaScript, HTML and CSS.
It was released in January 2006 at BarCamp NYC by John Resig.
In order to work with jQuery, you should be aware of the basics of JavaScript, HTML and CSS.
It was released in January 2006 at BarCamp NYC by John Resig.
Why jQuery?
jQuery is very compact and well written JavaScript code that increases the productivity of the developer by enabling them to achieve critical UI functionality by writing very small amount of code.- It helps to improve the performance of the application
- It helps to develop most browser compatible web page
- It helps to implement UI related critical functionality without writing hundreds of lines of codes
- It is fast
- It is extensible – jQuery can be extended to implement customized behavior
- No need to learn fresh new syntaxes to use jQuery, knowing simple JavaScript syntax is enough
- Simple and cleaner code, no need to write several lines of codes to achieve complex functionality
Where to Download jQuery from?
jQuery JavaScript file can be downloaded from jQuery Official website.How to Use jQuery?
jQuery usually comes as a single JavaScript file containing everything comes out of the box with jQuery. It can be included within a web page using the following mark-up:To Load Local jQuery File
<script type="text/javascript" src="jQuery-1.4.1-min.js"></script>
Ideally, this markup is kept in under <head></head>
tag of your web page, however you are free to keep anywhere you want.How to Execute jQuery Code?
There are two ways you may want to execute jQuery codes.-
As and when page loads, execute the jQuery code:
<script language="javascript" type="text/javascript"> $(function () { $("#div1").css("border", "2px solid green"); }); </script>
or:<script language="javascript" type="text/javascript"> $("#div1").css("border", "2px solid green"); </script>
However the disadvantage is that if the element on which jQuery has to execute has not loaded, then it will error out or you will not get the desired result; so while using this way of executing jQuery code, you will have to make sure that the element on which you want to work with jQuery is loaded first (you can place your jQuery code right after your HTML element). - Execute jQuery only when the complete DOM objects (the complete page has been loaded). You will have to wrap your code in .ready function.
<script language="javascript" type="text/javascript"> $(document).ready(function () { $("#div1").css("border", "2px solid green"); }); </script>
0 comments :
Post a Comment