What is the best way to manage this kind of situation :
$('.element').each(function() {
    $sibling = // find a sibling to $this.
    $mainElement = $(this); // memorize $(this)
    $sibling.change(function() {
       // when sibling changes
       // do something using $mainElement
       // problem is, $mainElement is not the element you think
       // $mainElement is the last .element found....
    })
});
One solution would be a table... But then there is no advantage for the change() to be nested in the each()...
My html example :
<div id="first">
  <span class="element"></span>
  <input name="first" type="text" />
</div>
<div id="second">
  <span class="element"></span>
  <input name="second" type="text" />
</div>
In this exemple, $sibling = $(this).next('input'); for instance.
 
     
     
     
     
    