Ads (728x90)

Techonlogy

Subscribe Here

Sponsor

Social Share

Recent

Business

Video

Gallery

videos

Introduction to jQuey Syntax
The jQuery punctuation is appropriately customized for selecting HTML components and perform some action on the element(s). With jQuery you select  HTML components and perform "actions" on them.

Syntax : $(selector).action()
  •  A $ sign to define jQuery.
  •  A (selector) to find HTML elements.
  • A jQuery action() to be performed on the element(s).
Examples:
  • $(this).hide() - hides the current element.
  • $("p").hide() - hides all <p> elements.
  • $(".hubkart").hide() - hides all elements with class="hubkart".
  • $("#hubkart").hide() - hides the element with id="hubkart".

You have to define all jquery methods inside a document ready event:

$(document).ready(function(){

 //Snippet code goes here
 });

This is to keep any jQuery code from running before the document is done loading.
Here are a few examples that can come up short if methods are keep running before the document is fully loaded:
  1. Attempting to hide a component that is not made yet
  2. Attempting to get the size of a picture that is not loaded yet

Post a Comment