onclick and onfocus events won't work when the button is disabled. However, you can add the event to the element that holds it.
For example, here is the HTML:
<table> <tr> <td onclick = "tdclicked(this)"> <input type="text" class="form-control" value="<?php echo $grade['grade'] ?>" id="gradeid1" disabled> </td> <td onclick = "tdclicked(this)"> <input type="text" class="form-control" value="<?php echo $grade['grade'] ?>" id="gradeid2" disabled> </td> <td onclick = "tdclicked(this)"> <input type="text" class="form-control" value="<?php echo $grade['grade'] ?>" id="gradeid3" disabled> </td> </tr> </table> and here's the Javascript.
function tdclicked(td) { for (var i = 0; i < document.getElementsByClassName("form-control").length; i++) { document.getElementsByClassName("form-control")[i].setAttribute("disabled", "true"); } inputField = td.children[0]; inputField.removeAttribute("disabled"); }