I have multiple buttons name="angka" and id="angka":
<input type="button" name="angka" id="angka" value="1" style="width:15px" onclick="insert(1)">
<input type="button" name="angka" id="angka" value="2" style="width:15px" onclick="insert(2)">
<input type="button" name="angka" id="angka" value="3" style="width:15px" onclick="insert(3)">
onLoadPage event I try to disabled them with the below code.
document.getElementById("operator").disabled = true;
document.getElementsByName("operator").disabled = true;
But the result is that only the first button is disabled, the other buttons are still enabled.
How to disable the buttons with JavaScript without making unique names or ids?
solve with
`var elements = document.getElementsByClassName("classname");
for (var i = 0; i < elements.length; i++) {
elements[i].disabled =true;
}`