Here's my code:
HTML:
<input type="checkbox" id="checkme"/>
<p class="label-text"><b>By checking this, you agree to our <a href="terms.html" onclick="window.open(this.href, 'mywin',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" style="color: red;">Terms & <br>Conditions</a> and <a href="privacy.html" onclick="window.open(this.href, 'mywin',
'left=20,top=20,width=500,height=500,toolbar=1,resizable=0'); return false;" style="color: red;">Privacy Policy</a></b></p>
<input class="formBtn" type="submit" id="submit" value="Submit" disabled="disabled" />
JavaScript
var checker = document.getElementById('checkme');
var sendbtn = document.getElementById('submit');
checker.onchange = function(){
if(this.checked){
sendbtn.disabled = false;
} else {
sendbtn.disabled = true;
};
jQuery
$( "#checkme" ).on( "click", function() {
if($( "#checkme:checked" ).length > 0) {
$('#submit').prop('disabled', false);
} else{
$('#submit').prop('disabled', true);
}
});
All not working. Please help.
Also help me add in the javascript a class for css to make the button transparent when disabled. Thanks a lot!
scripttag comes after the html elements you're dealing with (unless you use something like a$(document).ready()). Second, your JavaScript block is missing the close brace for theonchangehandler function. With those two changes, it worked properly for me