Thursday, 3 April 2014

How to disable and enable a button with checked condition?

<html>
<head>
<title>Untitled Document</title>
<script type="text/javascript">
function check()
{
if(TC.checked==true)
{

document.getElementById("ABCD").disabled=false;

}
else
{
document.getElementById("ABCD").disabled=true;
}
}
</script>
</head>

<body>
<input type="checkbox" name="TC" onclick="check()" />I have accept your Terms & Conditions<Br/>

<input type="button" id="ABCD"  disabled="disabled" value="Submit"/>
</body>
</html>

No comments:

Post a Comment