How To Start jQuery? | How to Write Simple jQuery? | How To start learn jQuery? | jQuery -- 2


In Last article we learn how to add jQuery library or CDN in web page. Now in this article we learn how to write simple code of jQuery. So

Let's start jQuery !!!

jQuery Syntax

In jQuery syntax mainly two parts 1) selector and 2) action.

  

$(SELECTOR).ACTION();



  • $ is access jQuery.
  • SELECTOR find HTML element.
  • ACTOIN() to be performed on elements.


Examples:


  
$("a").click();
$("#id").hide();
$(".class").show();
$(this).val();



DOCUMENT READY EVENT

Many time we see jQuery code write inside $(document).ready(); . It's prevent all jQuery code running before web page is finished loading.

  
$(document).ready(function(){


// your jQuery code


});



OR


  
$(function(){


// your jQuery code


});




Comments