I have a group of Selects. I am trying to do something like:
If each $("option:selected") has $(this).val='equal in all' do something.
But I don’t know if I try to put each value in a var then compare or do a count.
Maybe should it be something like IF ALL has….
This code works, but can see what to do with it…
It is inside an on change function, so it will alert only when I select
$("option:selected").each(function () {
alert ($(this).val();)
});
It is something like this.
If both(all) selects is selected if value= Show All, do something.
You can use the attribute equals selector, then check the
lengthproperty to see how many elements matched that selector.You can also compare how many values equal “equal in all” versus all elements selected by caching the first selector, then storing a filtered version (and comparing length). e.g.
Other than that, the question is a bit vague and maybe if you can be more explicit about what you’re going for I can update my answer.