We are providing online training of realtime Live project on Asp.Net MVC with Angular and Web API. For more information click here. If you have any query then drop the messase in CONTACT FORM

Sunday, June 28, 2015

Radio button Example in jquery.Select the radio button and click the button and display the result in alert box.

<html>
<head >
    <title></title>
    <script src="Scripts/jquery-2.1.1.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $("#btnSubmit").click(function(){
                if ($("input:radio[name=Gender]").is(":checked")) {
                    var v = $("input:radio[name=Gender]:checked").val();
                    alert("Selected Gender:" + v);
                }
                else {
                alert("Please select Gender");
            }
                return;            
            
            });
        
        });
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <b>Select Gender:</b>
        <br />
        <input type="radio" id="rdbMale" value="Male" name="Gender" />
        <label for="rdbMale">Male</label>
        <input type="radio" id="rdbFemale" value="Female" name="Gender" />
         <label for="rdbFeMale">FeMale</label>
        <br />
        <br />

        <input type="button" id="btnSubmit" value="Submit" />

    
    </div>
    </form>
</body>

</html>

OUTPUT:


No comments: