0

I have 2 variables storing 2 selectors,

<script>
    var checkedFilters = $(this).find('input:checked');
    var selectedFilters = $(this).find('option:selected');
</script>

i want to use them in one variable is there way to do it? i mean i want one selector to handle both input:checked and option:selected in the same time like this:

var filters = $(this).find('input:checked' or 'option:selected');

thank you in advinced

ahmd a
  • 31
  • 5

1 Answers1

0

Yes you can. You need to use Multiple Selector (“selector1, selector2, selectorN”):

var filters = $(this).find('input:checked,option:selected');
Milind Anantwar
  • 81,290
  • 25
  • 94
  • 125