I know this question has been asked endlessly, but going through all the answers i STILL can't get my checkbox/button function to work at all. I finally got it to stop returning "is not a function" but now it's just plain not working.
The purpose is to prevent form submission unless the legal disclaimer box is checked. Standard stuffs, no results... Please help!
function chkThis() {
var isChk = document.getElementsByName('agecert');
var isSub = document.getElementById('submit');
if (isChk.checked == true) {
isSub.setAttribute("disabled", "false");
} else {
isSub.setAttribute("disabled", "disabled");
}
}
<form>
<input name="agecert" type="checkbox" onclick="chkThis();" style="float: left;height: 20px;width: 25px;border: 1px solid red;" tabindex="8">
<p style="font-size: 10pt;left: 30px;position: absolute;text-align: justify;">Legal disclaimer stuffs...</p>
</div>
<div name="subres" style="width: 400px;height: 50px;top: 235px;left: 30px;position: relative;border: none;">
<button name="submit" type="submit" id="submit" style="left: 65px;" tabindex="9" disabled="disabled">Review Order</button>
<button name="reset" type="reset" style="left: 245px;" tabindex="10">Reset Form</button>
</div>
</form>
Aucun commentaire:
Enregistrer un commentaire