What is the best way to manage this kind of situation :
$(\'.element\').each(function() {
$sibling = // find a sibling to $this.
$mainElement = $(
I'd say the easiest bet for you is to use an .each on the siblings, and then finding the relative ".element" for the sibling. Depends on your code of course. Otherwise, something like this might work, even though it feels a bit redundant due to the .each:
$('.element').each(function() {
$(this).siblings('.sibling').change(function() {
var mainElement = $(this).siblings('.element');
// Do whatever you want here...
});
});