I have a GUI calcualtor, and I want to disable the digit buttons when the equal button is pressed.
Here is the HTML for the button which contains the digit 1:
<td>
  <button type="button" name="digit" value="1" value2 = "disabled">
    1
  </button>
</td>
This is the HTML for the equals button:
<button type="button" name="equals" value="=">
  =
</button>
Here is my JavaScript code attempting to disable it...
document.getElementsByName("equals")[0].addEventListener("click", function(){
  document.getElementsByName("digit").disabled = true;
});
Why is this not working? The event listener should disable it.
 
     
    