checking all checkboxes are checked using jquery

Posted by kumar on Stack Overflow See other posts from Stack Overflow or by kumar
Published on 2010-05-26T21:35:54Z Indexed on 2010/05/26 21:51 UTC
Read the original article Hit count: 201

Filed under:

Hello friends

I have two button one is SelectAll then MassEdit..

my code for select all is

$('#btnAll').click(function() {
            $('#ExceptionDetails input[type=checkbox]').attr('checked', 'checked');
        });

this check all the chekcboxes in my view.. then I have other button code which needs to take only checked checkbox information to send it other page.. to display only checked checkbox users..

$('#btnMassEdit').click(function() {
            $('#ExceptionDetails input[type=checkbox]').each(function() {
            if ($(this).attr('checked')) {
                    $('#specialist-tab').tabs('url', 3, '<%=Url.Action("getmasseditexceptions", "Expense", new { @GUI_SPEC_STAT_DSPL = GUI_SPEC_STAT_DSPL, @C_EXCPT_CATG = C_EXCPT_CATG, @C_EXCPT_TYPE = C_EXCPT_TYPE })%>').tabs('enable', 3).tabs('select', 3);
                    return false;
                } else {
                    alert("please select atleast one exceptin");
                    $().ShowDialog('Please Select Exception, Select atleast one exception');
                    return false;
                }
            });
  });

i have a fieldset which is ExceptionDetails..one field set have only one checkbox.. but my view having multiple fieldsets for differnt exceptions..

I need to check all the filedsset which is checked or not what ever the fieldset checkboxes are check I need to take only that exception to pass to the other page..

thanks

© Stack Overflow or respective owner

Related posts about jQuery