Not sure why but my script stopped working. It was supposed to prevent a person clicking the button unless they ticked the box. The button was also supposed to be half transparent unless the box is ticked. Now the button is clickable with or without checking the box.
Code:
<script type="text/javascript">
var chk = document.getElementById("agreement");
var anchor = document.getElementById("link");
anchor.style.opacity = "0.5";
anchor.onclick = function(e){
e.preventDefault();
}
chk.onclick = function(){
if(chk.checked){
anchor.style.opacity = "1.0";
anchor.onclick = "";
}
else{
anchor.style.opacity = "0.5";
anchor.onclick = function(e){
e.preventDefault();
}
}
}
</script>
<form><input id="agreement" type="checkbox" name="agreeCheckbox" value="agreeCheckbox" style="margin-bottom:7px;" required><span style="font-size:16px;"><b> Read <a href="/pages/faq.htm" target="_blank">FAQ</a> and didn't find an answer.</b></span></form></center>
<h1 style="text-align:center;margin-top:-25px;"><a href="/new" id="link" class="btn btn-danger2"/>Open ticket</a></h1>
Not sure if it is a server issue or some error in the code.
Aucun commentaire:
Enregistrer un commentaire