I'm having problems changing the text of a button control.
This is the html code of my button
<input type="submit" name="submit" id="btnsubmit" class="btn btn-default btnsubmit" value="Save" />
I want it to be done after populating the html table via php
This is my jQuery code
$( document ).ready(function() {
var checkedItems = $('#dataTable tr td').each(function() {
});
if (!checkedItems.size()) {
alert ("No data on the table");
}else {
alert ("this is else");
document.getElementById('btnsubmit').innerHTML = "Update";
}
});
What is wrong with my code?
I'm also using document.getElementById('btnsubmit').innerHTML = "Update";
to change the text of an input button in other page, why doesn't it work here?
The alert that shows is:
this is else