Reputation: 9532
I am trying to filter elements where data-value
is either 1
or 2
. How can I do it? I am trying:
$('body').find('[data-value="1|2"]');
And I'm pretty sure the pipe character was also used in jQuery to select between different values but apparently not.
I can use filter()
but I am looking for a more compact way like shown above, if possible.
Upvotes: 1
Views: 49
Reputation: 2504
Just use a comma
$('body').find('[data-value="1"], [data-value="2"]');
Upvotes: 3