Its really annoying me that I don\'t know the answer to this, I thought it would be simple. I want to get the next and previous elements from a selected element to a limit (
You can use nextAll and prevAll combined with the less-than :lt(index) selector (in your case :lt(2))
nextAll
prevAll
:lt(2)
var current = $('.active'), next = current.nextAll(':lt(2)'), prev = current.prevAll(':lt(2)'), all = current.add(next).add(prev);