title: JQuery - How to set parent attribute based on child attribute?
body: <p>I have the following table : </p>
  
  <pre><code>&lt;tbody&gt;
  &lt;tr data-id="#ID#"&gt;
      &lt;td class="t-Report-cell"  headers="ID"&gt;1&lt;/td&gt;
      &lt;td class="t-Report-cell"  headers="PARTICIPANT"&gt;61&lt;/td&gt;
      &lt;td class="t-Report-cell"  headers="ORDER_"&gt;1&lt;/td&gt;
      &lt;td class="t-Report-cell"  headers="INVITEDBY"&gt;61&lt;/td&gt;      
      &lt;td class="t-Report-cell"  headers="OPERATION"&gt;21&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr data-id="#ID#"&gt;
      &lt;td class="t-Report-cell"  headers="ID"&gt;21&lt;/td&gt;
      &lt;td class="t-Report-cell"  headers="PARTICIPANT"&gt;101&lt;/td&gt;       
      &lt;td class="t-Report-cell"  headers="ORDER_"&gt;1&lt;/td&gt;
      &lt;td class="t-Report-cell"  headers="INVITEDBY"&gt;61&lt;/td&gt;      
      &lt;td class="t-Report-cell"  headers="OPERATION"&gt;21&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/tbody&gt;
  </code></pre>
  
  <p>I would like to set the  attribute <strong>data-id</strong> based on the child attribute <strong>headers</strong>.</p>
  
  <p>I wrote the following code : </p>
  
  <pre><code>var el = this.affectedElements[0];
  
  // first part : not working
  $(el).find("[headers='ID']").each(function(){
      $(this).parent().attr('data-id',$(this).data("id"));
  });
  
  // second part : works
  $(el).find("tbody").sortable({
      items: 'tr'
    , containment: el
    , update: function(event,ui) { updateDisplaySeq(el); }
  });
  </code></pre>
  
  <p>The second part of the code makes the rows sortable and it's working, while the first part doesn't work.</p>
  
  <p>Can anyone help please ? </p>
  
  <p>Thanks.</p>