Tuesday, 18 June 2013

Hello jQuery

In jQuery, $ is variable which are chainable, (chainable means we can call multiple methods calls in chain, like,

$("#id").method1('value').method2('value2');

Don't worry, if you don't understand at this time. Later, you will learn it. 
  •     Selecting DOM object through jQuery, (if you don't know DOM, I will post on html DOM some other day, but then only you will understand it)
$("body") //selecting body of html

$("*") // * means all so it will select all elements of html DOM.

$('table') // to select all tables in html page.




General,

$('elems') // this will select all elements of html page, that are elems.
 

  • Selecting all css classes using jQuery,
$(".cssClass1") // this will select all elements that have cssclass1 class.

  • $("#id1") // this will select element having idi as id

For more list, please visit http://api.jquery.com/category/selectors/

No comments:

Post a Comment