Search code examples
jqueryappendclone

Select all Checked Checkboxes with Name Not Working


I must have my syntax incorrect, but I am trying to select all checked checkboxes in a table with the name "clone" and loop through them, but my code isn't working. Any help would be appreciated.

$('input[type="checkbox"][name="clone"]:checked').each(function(index, element) {
     alert( index );        
}); 

Also I was planning to append the table with selected rows one by one using the code below where the alert is. Please also let me know if there is a better way to do this as I am fairly new to Jquery.

$('#wizard_option_table').append( $(this).parents("tr:first") );

Solution

  • check jsFiddle

    jQuery

     $('input[type="checkbox"][name="chkbx\\[\\]"]').not(":disabled"));
    

    In question try this

     $('input[type="checkbox"][name="clone\\[\\]"]').not(":disabled"));