jquery - Do not select if the parent class is hidden -
with code below selecting checkboxes , radio buttons send them array.
var options = []; $('.option input[type="checkbox"]:checked, .option input[type=radio]:checked').each(function() { options.push($(this).val()); }); var options_checked = options.join(',');
there single radio buttons have parent class sass_syntax
, of course selected. don't want select them if class sass_syntax
hidden (display: none
). how can this?
you can exclude them using .not()
filter
var options = $('.option input[type="checkbox"]:checked, .option input[type=radio]:checked').not('.sass_syntax:hidden input').map(function() { return $(this).val(); }).get(); var options_checked = options.join(',');
Comments
Post a Comment