ahmed salah

ahmed salah

  • 1.2k
  • 547
  • 65.2k

How to check radio button have at least one selection using jQuery ?

Sep 13 2023 12:19 AM

I work on asp.net mvc project .I need to checj radio button list have at least one option selected using  jquery 

so how to check if radio button one from options selected using jquery client side please  

@model HR.WorkforceRequisition.Models.ResignationRequester
@{
    ViewBag.Title = "Requester Index";
    Layout = "~/Views/Shared/_LayoutResignation.cshtml";
}
<style>

    textarea {
        width: 100% !important;
    }

    #searchContainer {
        display: block;
        position: relative
    }

    #searchContainerDirector {
        display: block;
        position: relative
    }



    .ui-autocomplete {
        position: absolute;
    }
</style>
<form id="ResignationApp"  style="padding-top: 50px">
    @Html.AntiForgeryToken()

    
        <label class="control-label">Employee Informed of Restrictions On :</label>
        <span class="text-danger"> *</span>
        <div class="form-group" style="margin-left:20px;">

            <div class="row">
                <div class="col">
                    <label class="radio-inline">

                        @Html.RadioButtonFor(model => model.EmployeeRestrictions, "Solicitations of Customers")
                        Solicitations of Customers
                    </label>
                </div>
                <div class="col">
                    <label class="radio-inline">

                        @Html.RadioButtonFor(model => model.EmployeeRestrictions, "Customers Lists")
                        Customers Lists

                    </label>
                </div>
                <div class="col">
                    <label class="radio-inline">
                        @Html.RadioButtonFor(model => model.EmployeeRestrictions, "Confidentiality Obligations")
                        Confidentiality Obligations

                    </label>
                </div>
                <div class="col">
                    <label class="radio-inline">

                        @Html.RadioButtonFor(model => model.EmployeeRestrictions, "Removing Company Document")
                        Removing Company Document
                    </label>
                </div>
                <div class="col">
                    <label class="radio-inline">

                        @Html.RadioButtonFor(model => model.EmployeeRestrictions, "Restrictions on Solicitations of Employee")
                        Restrictions on Solicitations of Employee
                    </label>
                </div>
                <div class="col">
                    <label class="radio-inline">
                        @Html.RadioButtonFor(model => model.EmployeeRestrictions, "Others If Any")
                        Others If Any
                    </label>
                </div>
            </div>
        </div>
        <div class="form-group">
            <div class="col-md-offset-0 col-md-12">
                <input id="btnsubmit" type="submit"  class="btn btn-success" />

            </div>
        </div>
    </div>
</form>
<script>   
    $(document).ready(function () {
    // validate radio button have value or not    
  });
</script>
@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")
}

 

so please how to check if group of radio button have at least one selected or checked using jquery


Answers (3)