You could do something like this:
var inp = $('input');
var index = inp.index(this);
var next = inp[index+1];
var prev = inp[index-1];
Note that prev and next, just like this are not jQuery objects but DOM object now. To make them jQuery objects you need to wrap them in the $() function.
Pim Jager
2009-06-11 16:01:15