javascript - 'undefined' returned from .each ran on tr with id selection -
problem
i'm trying run through every row in table has id in particular format. correct number of rows being selected i'm encountering 'undefined' issue whenever try attributes obj.
<tr class="" data-uid="45" id="fixed_user_45">...
and javascript...
$('tr[id^="fixed_user_"] ').each(function(obj, i) { var id = $(obj).id; // returns 'undefined' console.log(id); //prints 'undefined' correct number of times });
this happening regardless of attribute try select, , how go - i.e. innertext, innerhtml, .attr('data-uid'). undefined.
other details:
for completeness... i'm going cycle through each of td after have nested following within above each function.
$('td').each(function (obj, i) {
thanks help.
obj
index , i
element case. data-uid
use data()
function below.
$('tr[id^="fixed_user_"] ').each(function (obj, i) { var id = $(i).data('uid'); console.log(id); });
Comments
Post a Comment