Jquery is JavaScript Library
It is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development.jQuery is designed to change the way that you write JavaScript.
How to use JQuery ?
To use JQuery we need to add below code
<
script
type="text/javascript" src="jquery.js"> < /script >But remember if jquery.js is in the same directory as your HTML file, then give give the above path.I will suggest to make javascript in separate directory, like "/_js" folder , In that folder you can include your update version jquery.js and your own JS file which you use in your site like "global.js"
So path can be :
<
script
type="text/javascript" src="_js/jquery.js"> < /script ><
script
type="text/javascript" src="_js/global.js"> < /script >You can download your new version of jQuery.js from the Jquery.com
jQuery has a simple statement that checks the document and waits until it's ready to be manipulated, known as the ready event
$(document).ready(function(){
// Your code here
});
Example :
Inside the ready event, I have added click handler to the link:
$(document).ready(function(){
$("a").click(function(event){
alert("It is easy......");
});
});
If you want the convenience of the
$
function for jQuery without collidingsome other use of the global
$
function,the jQuery documentation suggests thefollowing
:
(function($) {
// Within this block, $ is a reference to jQuery
});