I need help accessing a button inside a div
html, javascript, jquery
Solution
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
Problem
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.