I can’t find a solution.
How can I loop through all the elements starting from the one who has biggest width (in this case the elements with the class elname_03).
I have several div elements that have the same class name and I’m looping thru them.
Maybe there is a selector to do it?
<div class="el elname_01"></div>
<div class="el elname_03"></div>
<div class="el elname_02"></div>
<div class="el elname_03"></div>
<div class="el elname_02"></div>
<div class="el elname_03"></div>
- elname_01 – width 100px
- elname_02 – width 150px
- elname_03 – width 200px
I need to start checking from elname_03, after all they passed through the loop, then I need to loop all 02 numbers. I want to do this with one each, if it’s possible, because I’m parsing data from json.
You can try to sort jQuery object as array, and then iterate through it:
Here’s working JSFiddle: http://jsfiddle.net/7BzH4/