Disable radio button

We can enable or disable radio buttons ( Period buttons ) by using a checkbox inside a form. We know by radio button we can select on of the several available options. Let us try first by directly disabling a radio button.

Male FeMale

Here is the code
<input type=radio name=sex value=male id='r1' disabled>Male 
<input type=radio name=sex value=female id='r2'>FeMale
But here we are not able to change the status as per requirement so we will use JavaScript here to manage the radio buttons by using a checkbox. Let us see how this script works. Here is the code.
<title>Demo of enable disable period button by checkbox</title>
<link rel="stylesheet" href="../images/all11.css" type="text/css">
<script language="JavaScript">

function enable_radio(status)
<body onload=enable_radio(false);>

<form name=f1 method=post action=period-disable-demock.php>
<input type="checkbox" name=others onclick="enable_radio(this.checked)" value='yes'>Others<br>
<input type=radio name=sex value=male id='r1'>Male 
<input type=radio name=sex value=female id='r2'>FeMale 
<input type=submit value=Submit>


* indicates required
Subscribe to plus2net


    More on Period button & JavaScript

    Post your comments , suggestion , error , requirements etc here .

    We use cookies to improve your browsing experience. . Learn more
    HTML MySQL PHP JavaScript ASP Photoshop Articles FORUM . Contact us
    ©2000-2022 plus2net.com All rights reserved worldwide Privacy Policy Disclaimer