Select one checkbox from group of checkbox using jquery | Coding Cluster - using asp.net, c#, mvc 4, iphone, php, ios, javascript, in asp.net mvc 3 & more
 

Select one checkbox from group of checkbox using jquery

Monday

Multiple Checkbox validation in asp.net mvc 3 using jquery:

This is the sample code for select only one check box from a check box group.


function ValidateChkBox()
    {
        var selectedCheckBoxesValue = '';

        $('#DIVID').find("input:checkbox.CheckBoxClassName:checked").each(function (i, selected) {
                                                            if (selectedCheckBoxesValue.length == 0) {
                                                                selectedCheckBoxesValue += $(selected).val();
                                                            }
                                                            else {
                                                                selectedCheckBoxesValue += ',' + $(selected).val();
                                                            }});
            // Here you also get all the comma separated values if you want else use below method for it
        if(selectedCheckBoxesValue.length == 0)
        {
            alert("Select atleast one checkbox");
        }
    }

1 comments:

smartsuite said...

I believe Web time sheet software makes the complete employee time clock tracking task easier. Its easy to update, approve and maintain the time sheets in no time.Time Attendance System

Post a Comment

Share your thoughts here...

 
 
 

RECENT POSTS

Boost

 
Blogger Widgets