javascript - Using select all script for filtered table -


i using this (file here) script , using check script in first row checkboxes. first when filtered column, script selected checkboxes @ hidden rows, too.

$(document).ready(function(){ $('#select_all').on('click',function(){     if(this.checked){         $('.checkbox').each(function(){             this.checked = true;         });     }else{          $('.checkbox').each(function(){             this.checked = false;         });     } });  $('.checkbox').on('click',function(){     if($('.checkbox:checked').length == $('.checkbox').length){         $('#select_all').prop('checked',true);     }else{         $('#select_all').prop('checked',false);     } }); }); 

thanks helps.

use jquery :visible selector leave out checkboxes have been filtered. https://api.jquery.com/visible-selector/

$('#select_all').on('click',function(){     var docheck = this.checked;     $('.checkbox:visible').each(function(){          this.checked = docheck;     }); }); 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -