I have a jQuery function that binds the click event of any element on my page with the class name ‘foo’.
$('.foo').click(function () { etc.
Whilst inside this function I want to reference another element that exists alongside the currently bound element – inside the same div but with the class name ‘bar’.
How do I go about referencing ‘bar’ based on it’s proximity, within the same div?
If the elements are at same level you can use siblings i.e.:
If the hierarchy is different then try this: