I’m trying to toggle a specific selection of elements. I want to hide elements based on a selection, then show those exact same elements. I tried to use this code but the rows don’t “show” because it seems to re-check which ones are visible.
jQuery(function($){
$('input[id^=_cmb_api_use_defaults_]').click(function(){
var $rows = $(this).parents('tr:first').nextAll('tr:visible');
if($(this).is(':checked')){
$rows.hide();
} else {
$rows.show();
}
});
});
How can I store those specific elements, so i can manipulate the exact same table rows later?
Simply use a variable declared outside the function: