This question already has an answer here:
Can someone tell me how to detect if "specialword"
appears in an array? Example:
categories: [
"specialword"
"word1"
"word2"
]
This question already has an answer here: Can someone tell me how to detect if
|
|||||||||
marked as duplicate by Bergi, lonesomeday, Omar, madth3, Marc Audet Jul 3 '13 at 0:25This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question. |
|||||||||
|
jQuery offers
Note that inArray returns the index of the element found, so Edit 3.5 years later
|
|||||||||||||||||||||
|
You really don't need jQuery for this.
or
It's worth noting that |
|||||||||||||||||||||
|
Just use a
|
|||||||||
|
Here you go:
This function returns a positive integer (the array index of the given value), or Live demo: http://jsfiddle.net/simevidas/5Gdfc/ You probably want to use this like so:
|
||||
|
I don't like
Similarly, you could wrap
|
|||||||||||||
|