Difference between revisions of "Jquery element querys"

From John Freier
Jump to: navigation, search
Line 6: Line 6:
  
 
Not - When getting a group of items, this will exclude certain ones.
 
Not - When getting a group of items, this will exclude certain ones.
   $('.clazz').not('.blue').click(function(){});
+
   $('.clazz1').not('.clazz2').click(function(){});
 +
 
 +
 
 +
Table : last row - This gets the last row in table
 +
 
 +
fyi, "after" means after that element, in this example it is used to add a row on a table.
 +
 
 +
  $('#tableId tr:last').after(html_str);

Revision as of 14:27, 22 September 2011

These are different ways in JQuery to query for the element(s).

Check boxes

 $('[type="checkbox"]').click(function(){});


Not - When getting a group of items, this will exclude certain ones.

 $('.clazz1').not('.clazz2').click(function(){});


Table : last row - This gets the last row in table

fyi, "after" means after that element, in this example it is used to add a row on a table.

 $('#tableId tr:last').after(html_str);