mardi 26 janvier 2016

Disable button using checkbox JavaScript

Hello I want to disable two buttons when the checkbox is checked but for it result I must click two times in the checkbox hope someone can help me.

Thanks.

var checker = document.getElementById('checkme');
var button = document.getElementById('button');
var button2 = document.getElementById('button2');

document.getElementById("button").disabled = true;
document.getElementById("button2").disabled = true;


checker.onchange = function() {

button.disabled !! this.checked;
button2.disabled !! this.checked;

};




Aucun commentaire:

Enregistrer un commentaire