Created
October 22, 2013 13:55
-
-
Save codeodor/7101231 to your computer and use it in GitHub Desktop.
What I really want is $(‘option [value :in(1,2,3)]’) to select all options whose value is 1, 2, or 3.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Example: | |
select 2 has, say 10 options: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 | |
select1_option0 should hide nothing in select2 | |
select1_option1 should hide all but select2: options 1, 2, and 3 | |
select1_option2 should hide all but select2: options 1, 2, 3, and 9 | |
select1_option3 should hide all but select2: options 5, 6, and 7 | |
select1_option4 should hide all but select2: options 4, 6, 8, and 1 | |
I could easily loop over the data, but it occurred to me a jquery selector would be much nicer. I was thinking something like: | |
$(‘option [value :in(1,2,3)]’).attr('disabled', true) | |
Any better ideas than simply looping over the data or combining into one selector something as bad as: | |
$(‘option [value=1], option [value=2], option [value=3]’).attr('disabled', true)\ | |
? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In essence it looks about what you said, but the rules were not as complex as you might have originally imagined since I could describe them with a hash.