tags:

views:

30

answers:

2

So if I had an input element in a certain div and another input element in that same div, is there a way I could reference that second input element from a $(this) that came from a change event of the first input element? This way I could have an infinite number of possible divs but each change would only effect the second element of that is sharing the div with the first element (which called the change event)?

+4  A: 
$(this).next('input')

or if it's before:

$(this).prev('input')

or if you're not sure:

$(this).siblings('input')
John Rasch
Ah sorry, I posted siblings before you edited. I'll delete mine and +1.
Alex Barrett
Also .nextAll('input') and .prevAll('input')
R. Bemrose
A: 

As I've told you in my answer to your other recent question, you are looking for ways to traverse the DOM. You can find the documentation on the functions mentioned by John over here.

middus