Saturday, 17 August 2013

What is jQuery Selectors? Give some examples.

  • jQuery Selectors are used to select one or a group of HTML elements from your web page.
  • jQuery support all the CSS selectors as well as many additional custom selectors.
  • jQuery selectors always start with dollar sign and parentheses: $()
  • There are three building blocks to select the elements in a web document.
1) Select elements by tag name
Example: $(div)
It will select all the div elements in the document.
2) Select elements by ID
Example: $(#xyzid”)
It will select single element that has an ID of xyzid
3) Select elements by class
Example: $(“.xyzclass”)
It will select all the elements having class xyzclass

No comments:

Post a Comment