Disable the button if the checkbox is unchecked

Saratvaddilli
Posted by Saratvaddilli under JavaScript category on | Points: 40 | Views : 3364
<script language="Javascript" type="text/javascript">
function enable(){
if (document.agreement_form.agreed.checked==''){
document.agreement_form.submit_button.disabled=true
}else{
document.agreement_form.submit_button.disabled=false
}
}
</script>

.....
<form name="agreement_form">
<input type="checkbox" name="agreed" onchange="enable()">Do you want to test ?
<br>
<input type="submit" value="Submit" disabled name="submit_button">

Comments or Responses

Login to post response