Want to add a td padding with jquery
2 answers
JQuery selectors
are based on CSS selectors. "space" between selectors finds all children of the parent node (recursively).
In this way:
$('#myDiv td')
Finds #mydiv first, then gets all descendants (finds children recursively) and then checks if they are 'td', filtering out the rest.
If you only want to apply the class to the immediate children of '#mydiv':
$('#myDiv > td')
+2
a source to share