Saturday, November 1, 2014

How to use jQuery

HTML

<p>ddddddddd</p>

jQuery

$(function(){
    $("p").css({"font-size":"20px"});
});



Note 1

$(function(){
});

//this is equal to document.ready 

$(document).ready(function(){ });

Note 2

$(selector).action();

Note 3

one of action is css. 
css({"property1":"value1","property2":"value2"});

Note 4

change $ to jQuery to avoid conflict

jQuery(function(){
    jQuery("p").css({"color":"red"});
});    

Note 5

jQuery starts with $ and end with ;
middle with () anonymous function

regular expression ^ means start, $ means end







No comments:

Post a Comment