Reputation: 543
I have a big div containing many divs inside, I need to get the text from those inner divs but at certain condition, something like this:
for (var i = 0; i < g; i++)
{
var h = $('#infor > div').["dataid = i"].text();
alert(h);
}
(infor) is the id for the big div and (dataid) is the attribute of the inner divs
Upvotes: 1
Views: 130
Reputation: 82241
You need to use:
var h = $('#infor > div[dataid = '+ i +']').text();
Upvotes: 3