jqeury: how to select all named class within a table row in jquery
I am currently working on a bootstrap x-editable table. I need to select
all nodes with a give named class WITHIN a table row and trigger their
.editable(). Here is my jquery selector code.
<table class="table table-bordered">
<thead>
.............
</thead>
<tr>
<td><a class="myeditable editable-user" data-type="select"
href="#">user...</a></td>
<td><a class="myeditable editable-date" data-type="date"
href="#">date...</a></td>
<td><a class="myeditable editable-user" data-type="text"
href="#">description..</a></td>
<td><span class="actions"><a class="myButton" href="#">submit
changes</a></span></td>
</tr>
<tr>
.......... the same contents as above
</tr>
</table>
my script should be something like:
$('.myButton').click(function(){
// only this row of 'myeditable' should be selected
$(this).closet('td')
.siblings.children('.myeditable').editable('submit', {....});
});
Could anyone has a better solution to select elements by given classes
within a table row under my Html structure? many thanks!
No comments:
Post a Comment