DEMO : Enable disable Checkbox by using buttons
← Tutorial on Checkbox disable
Managing Checkboxes by Reading status and validating with option to enable or disable in a form
JavaScript
<SCRIPT LANGUAGE="JavaScript">
<!--
function chk_control(str) {
if(str=='dsb'){document.getElementById('ck1').disabled=true;}
else {document.getElementById('ck1').disabled=false;}
}
// End -->
</script>
HTML
<form name=form1 method=post action=check.php>
<table width=200 >
<tr ><td ><input type=checkbox name=ckb id=ck1 value=1></td><td >PHP</td></tr>
<tr ><td ><br><br><input type=button value='Disable' onClick="chk_control('dsb')";></td>
<td ><br><br><input type=button value='Enable' onClick="chk_control('enb')";></td></tr>
</table></form>
←JavaScript Checkbox Reference
← Subscribe to our YouTube Channel here
This article is written by plus2net.com team.
plus2net.com