| |
These are some example jquery code to traverse the DOM. With jquery you can get anything from the webpage |
| |
|
| |
jQuery uses JavaScript’s native getElementById() to find an ID in the document. |
| |
To find by ID use :
ID : $(’#some-id’) |
| |
To find by Element : $('div') |
| |
To find by Class : $('.some-class'); |
| |
|
| |
| Team A |
Ben,Joe,Rick |
| Team B |
Emmi, Ken,Jim |
| Team C |
Taro,Jen,Gale |
| Team D |
Cris,Lara,Brad |
|
| |
Above table has the id="table1" |
| |
| (1) |
$('#table1').find('tr:odd')gets the odd row in the table See it [toggle] |
|
| |
| (2) |
$('#table1').find('tr:even')gets the even row in the table See it [toggle] |
|
| |
|
| |
More Traversal Methods will be added soon ... |
| |
|