Pages

Saturday, 20 January 2018

HTML form control selector test


Check Radio button check


Gender : Male Female

Code :

  Gender :
    <input type="radio" name="gender" id="rdomale" checked="checked" />Male
    <input type="radio" name="gender" id="rdofemale" />Female
    <input type="button" value="Check" onclick="Checkradio()" />

<script>

        function Checkradio() {
            if (document.getElementById('rdomale').checked == true)
                alert('Male option is selected');
            else
                alert('Female option is selected');
        }
    </script>

Download Source Code

No comments:

Post a Comment