0
I’m trying to give disabled on all buttons with the same name, but it doesn’t work, what I’m doing wrong?
//HTML BOTÃO QUE EU QUERO DESATIVAR
<button class="teclado" id="Q" name="nameTeclado" onClick="forca(this.id);">Q</button>
//HTML BOTÃO QUE ESTOU USANDO PARA DESATIVAR
<button onClick="teste();">teste</button>
//JS
function teste() {
document.getElementsByName("nameTeclado").disabled = "true";
}
There are many buttons that I need to disable at once, so I can’t do with get.elementById (which in this case works)
Your code won’t work Juliano, true is not a string.
– LeAndrade
Yes, I have corrected that detail. Now I tested it here and it worked that way, I was missing to turn the buttons into an object
Array
also :)– echojn