Introduction

jQuery is a lightweight JavaScript library for DOM manipulation. It was written by John Resig and released in August 2006.

A compressed (production ready) file can be downloaded from https://jquery.com/download/ and included in an HTML document as


<script src="jquery.min.js"></script>

or it can be included directly from the CDN


<script src="//code.jquery.com/jquery-latest.min.js"></script>

jQuery code blocks goes inside a function passed to the ready method, which are then executed when the Document Object Model (DOM) is fully loaded


<script type="text/javascript">
	$(document).ready(function(){
	        // jQuery code here
	});
</script>

Equivalently, we can shorten it to


<script type="text/javascript">
	$(function() { 
		// jQuery code here
	});
</script>