开发者

How to operate jQuery object correctly?

$('table.diyform').children('tbody').children('tr').each(function() {
    var $tds = $(this).children('td');
    var label = $tds[0].find('a').html();
    var required = $tds[0].find('input').html(开发者_Python百科);
});

The problem lies in $tds[0] but I don't know the correct way to do it yet.


You will need to use eq.

$('table.diyform').children('tbody').children('tr').each(function() {
        var $tds = $(this).children('td');
        var label = $tds.eq(0).find('a').html();
        var required = $tds.eq(0).find('input').html();
});


Try:

var tds = $(this).children('td');
var label = $(tds).find('a').html();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜