Wednesday, February 20, 2013

jQuery

 jQuery Syntax

The jQUery syntax is tailor made for selecting HTML elements and perform some action on the elements.
Basic syntax is : $(selector).action()

-> A $ sign to define/access jQuery
-> A (selector) to query HTML elements
-> A jQuery action() to be performed on the elements


Examples:
$(this).hide() - hides the current element.
$("p").hide() - hides all elements.
$(".test").hide() - hides all elements with class="test".
$("#test").hide() - hides the elements with id="test"

jQuery example

jQuery is a JavaScript Library. It is greatly simples JavaScript Programming. It is easy to learn.


Try it yourself......


Type this code Then click on a button to view the result
$(document).ready(function(){
  $("p").click(function(){
    $(this).hide();
  });
});