How to get a value of data-attribute with jquery
<p>I need to get the value of userid, data-attribute from a html table and put this value into a var, but I wanna to this action without click action. </p>

<pre><code>  &lt;table id="tblList"&gt;
    &lt;tbody id="someTest"&gt;
      &lt;tr data-userid="801992084067"&gt;
      &lt;tr data-userid="451207954179"&gt;
      &lt;tr data-userid="310896831399"&gt;
      &lt;tr data-userid="863939754980"&gt;
      &lt;tr data-userid="1123542226482"&gt;
    &lt;/tbody&gt;
  &lt;/table&gt;
</code></pre>

<p>I have tried to do this like that, but the rowId is undefined.</p>

<pre><code> var rowId = $("#someTest tr").last().attr("[data-userid"]");
</code></pre>