jQuery
jQuery is an open source JavaScript library which simplifies the interaction between HTML and JavaScript. It was created by John Resig in 2005 and released in January of 2006.
What is jQuery ?
- It is a JavaScript library
- It greatly simplifies JavaScript programming.
- It is lightweight
- Works on "write less, do more".
- Makes it easier to use JavaScript in websites.
- Wraps many common tasks that may require lines of JavaScript.
- Can be called using functions.
- Many big companies like
- Google
- Microsoft
- IBM etc. use jQuery.
Why jQuery ?
- Fully documented
- Great community
- Tons of plugins available
- Small size
- Works in all browsers.
- Contains:
- HTML / DOM manipulations
- CSS manipulations
- HTML event methods
- Effects and Animations
- AJAX
- Utilities
Example:
<html>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
$(document).ready(function){
$("button").click(function){
$("p").hide();
});
});
</script>
<body>
<h1>Example page for jQuery</h1>
<p>This line hides when you click the button</p>
<button>click to hide</button>
</body>
</html>
In above example jQuery function will hide the line under the paragraph tag upon clicking the button.
How to add jQuery to your webpage ?
2. Include from a CDN (Content Delivery Network) like Google or Microsoft.
Example: Include from Google
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js">
</script>
</head>
Example: Include from Microsoft
<head>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.10.2.min.js">
</script>
</head>
*Note: Inclusion from jQuery leads to faster loading of the website.
jQuery Syntax, Effects, Functions etc in coming posts...