title: jQuery - Find element with custom attribute inside a table row
body: <p>I have a table that looks like something below (just some pseudo code)</p>
  
  <pre><code>&lt;table&gt;
  &lt;tr&gt;&lt;td&gt;text11&lt;/td&gt;&lt;td&gt;text12&lt;/td&gt;&lt;td&gt;&lt;div customerid='1'&gt;Customer 1&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;text21&lt;/td&gt;&lt;td&gt;text22&lt;/td&gt;&lt;td&gt;&lt;div&gt;Customer 2&lt;/td&gt;&lt;/tr&gt;
  &lt;tr&gt;&lt;td&gt;&lt;div customerid='2'&gt;xxxx-yyyyy&lt;/div&gt;&lt;td&gt;text23&lt;/td&gt;&lt;td&gt;text33&lt;/td&gt;&lt;/tr&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I am iterating over each row of the table. I need to find out element in a row that has a custom attribute for example "customerid" as shown in above example. Few requirements of this search.</p>
  
  <ul>
  <li>The cell is not fixed where this custom attribute will appear</li>
  <li>HTML element type is not fixed on which this custom attribute will appear. That means any selector like $('div') etc. is out of question.</li>
  <li>Search will be performed at individual row level and not at table level</li>
  </ul>
  
  <p>Here is what i was trying that seems to return "undefined" all the time.</p>
  
  <pre><code>rows = $(self.find('tbody tr').each(function (rowIndex, element) {
    var keyValue = getKeyValue($(element));                  
  }));
  
  function getKeyValue(row){
    return row.attr('customerid');
  }
  </code></pre>
  
  <p>.attr method does not seem to work. I have debugged to verify that 'row' is actually correct table row and HTML is correct as well and contains a cell with a div that has my custom attribute on it.
  Any suggestions will be appreciated.</p>
  
  <p>Thanks</p>