Let's say I have a html code like this:
<div class="color">
<span>red</span
</div>
<div class="color">
<span>green</span
</div>
<div class="color">
<span>blue</span
</div>
What I want is to get the second div with the class "color". I know I could loop through them with each() and get it from the loop, but I'm pretty sure there's an easier way to do this.
var id = 1
function GetColor(id) {
//get the second div with the class "color"
}
How could this be done?