header

The Document Ready Function

Many jQuery actions can fail if they are run before the document is fully loaded. To prevent this, it is recommended to wrap all jQuery functions in a document ready function as follows:

$(document).ready(function(){

// jQuery functions go here.....

});

jQuery Name Conflicts

jQuery uses the $ sign as a shortcut for "jQuery". This may conflict with other JavaScript libraries that also use the dollar sign for their functions.
The jQuery noConflict() method specifies a custom name (like jq), instead of using the dollar sign.

The jQuery Syntax is tailor made for selecting HTML elements and perform some action on the element(s)

The basic syntax is:

$(selector).action()

  • A dollar sign ($) to define jQuery
  • A (selector) to find HTML elements.
  • A jQuery action() to be performed on the selected element(s)

Example:1

To Hide the example:

$("p").hide()



To show more Examples of jQuery- Selectors Click:



Valid CSS!

home