I'm trying to update the value attribute of a button inside a table cell.
I'm iteration over each cell and my code looks like this:
for (var i = 0, cell; cell = table.cells[i]; i++) {
$(cell).find('.btn btn-default').val("new value");
}
But this doesn't work.
My 'cell' looks like this:
<div class=\"list-element\">
<a class=\"glyphicon glyphicon-link\" href=\"www.somelink\"></a>
<input class=\"btn btn-default\" type=\"button\" value=\"some stuff\">
<label class=\"label label-success\">stuff</label>
</div>
So i want to change "some stuff".
Any help would be greatly appreciated.
Try this:
for (var i = 0, cell; cell = table.cells[i]; i++) {
$(cell).find('.btn.btn-default').val("new value");
}
Remove space in find method
for(var i = 0, cell; cell = table.cells[i]; i++) {
$(cell).find('.btn .btn-default').val("new value");
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With