How to get the data from a row jQuery

烂漫一生 提交于 2019-12-01 14:55:21

Does this help you?

http://jsfiddle.net/KzXjb/3/

$('#out').click(function(){   

    var data = new Array();

    $("table select, table input").each(function(){
       data.push($(this).val());
    });

    alert(data.toString());

})

Here is what I think you meant

http://jsfiddle.net/mplungjan/8xFFH/12/

$('#out').click(function(){    
        var tr = 1;
        $('table tr').each(function(){
            var td = 1;
            $(this).find('td').each(function(){
                var fld = $(this).find('select, input');
                alert(fld.val());
                td++;
            });
            tr++;
        });
    })

You can try something like this :

$('#out').click(function(){    
    $('table tr').each(function(){
        var td = '';
        $(this).find('option:selected').each(function(){
           td = td + ' ' + $(this).text();
        });
        td = td + ' ' + $(this).find('input').val();
        alert(td);
    });
})

If i correctly understand what you need ^^

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!