How to Select Radiobutton value in mvc4

How to Select Radiobutton value in mvc4

Step 1 : first Create the raddiobutton as following

View:

     <div class="editor-field">
            @Html.RadioButtonFor(model => model.Gender,"Male",true)Male
            @Html.RadioButtonFor(model => model.Gender,"Female",false)Female
        </div>


Step 2: Now Select radiobutton using Jquery code as following

function InsertData()
 {
    var radio = $('[name="Gender"]:radio:checked').val();
}

here using the name attribute we can select the radiobutton value by using jquery.
Previous
Next Post »