Syntax Overview of jQuery

jQuery Library

  • Special installation and compilation is not required to execute a program.
  • Download and include the jquery library file into the .html files.

CDN based version

  • jQuery library can be included directly in the HTML code from Content Delivery Network (CDN).
  • Latest version of the content deliver is provided by Google and Microsoft.
  • Google CDN :
  • Microsoft CDN :

Steps to write jQuery code

  • Download jQuery library (jquery.js or jquery-1.3.2.min.js).
  • Create a new folder in any directory of your choice.
  • Drag and drop the jquery.js file into the folder that is created by you.
  • Create a reference of jQuery library in the html file by adding the following snippet in a web page.

  • <head>
         <script type = “text/javascript” src = “jquery.js”>

    jQuery Syntax

    The jQuery syntax is written to select the HTML elements and perform some action on these elements.

         $ sign defines the jQuery.
         (selector) finds the HTML elements.
         action() is type of event that performs some type of action on the elements like click, hide etc.

    1. $(document).ready(function() {….})
    It prevents any jQuery code from getting executed before the document is ready or loaded.

    2. $(this).hide()
    It hides the current element.