I am searching for something to make me able control separately each element returned by .prevAll() or .nextAll() jQuery methods.
Something like:
<div id="home">
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
<div class="box"></div>
</div>
And something like:
$('#home .box').mouseover(function(){
var hovBox = $(this);
var prevAll = hovBox.prevAll();
var nextAll = hovBox.nextAll();
nextAll.each(function(){
// ...and do something with each returned element
// NOT with ALL returned elements, just handle each separately
// through some other type of selector
});
});
Thank you for your help
$.each allows you access the DOM element using
this:Here’s the Fiddle:
http://jsfiddle.net/2MMGw/1/
http://api.jquery.com/each/