jQuery Syntax

jQuery Syntax
jQuery is most popular famework to resuce the javascript code. Using this you can write the code quickly and also apply effect to your page. jQuery is made by two important thing. First one is selector and second one action.

Syntax:
$(document).ready(function(){
$(selector).action();
});

  • $ sign to define/access jQuery
  • (selector) to "query (or find)" HTML elements
  • jQuery action() to be performed assigned action on element.

Selectors Like this
  • $(this)
  • $('html tag') like $('div')
  • $('classname) like $('.red_btn');
  • $('idname') like $('#green_btn');

Example:
$(document).ready(function(){
$(".red_btn").click(function(){
$("img").fadeIn();
});
});
Copyright Labw3