jquery - Select a parent's child using index -
:nth-child()
- selector used select each element nth child of parent.
are there ways select parent's child using index value? want , set each child's properties individually. structure of code is:
for (var i=0;i<length;i++) { //create selector choose first child using `index` value //change each child's properties }
i hope me out. in advance.
you can use $.each()
simple example (jsfiddle): html:
<table> <tr id="test"> <td>a</td> <td>b</td> <td>c</td> <td>d</td> <td>e</td> </tr> <table>
jquery:
$.each($("#test").children(), function(index, data){ alert(index); });
Comments
Post a Comment