Getting the index of an element with a given class
Hello folks,
I have a bunch of elements with multiple classes like this:
- <div class="foo bar">
- <div class="foo bar snafu">
- <div class="foo bar">
I can get all these elements in an array like this:
- $ (".foo,.bar")
My question is - is there an elegant way of getting the index (in this array) of the element that has the "snafu" class? Or should I just iterate through the array until I find the wanted element and then remember its index?