Home > jQuery > jQuery 1

jQuery 1

Basic:

  • jQuery = $
  • $(‘document’).ready;
  • $jQobj // var jQuery object(variable);
Query:
  • $(“div”) // selecting all the “div” elements in DOM;
  • $(“#elementId”) // selecting all the elements with ID “elementId” in DOM;
  • $(“.className”) // selecting all the elements with class “className” in DOM;

Change:

  • jQobj.add(“div”); // add “div” into the jQobj selector;
  • jQobj.addClass(“className”); // add class “className” to jQobj;
  • jQobj = $(“div”).last(); // select the last (can be first) “div”;
  • jQobj = $(“div”).eq(2); // select the third (can be others) “div”;
  • jQobj = $(“div”).filter(“li”); // select the div(s) that contain “li” (or any selector, function);

http://www.w3schools.com/jquery/jquery_dom_add.asp

Categories: jQuery Tags:
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: