单击时的 jquery 列值

标签 jquery

我有一个包含 5 列的表格,当我单击该行的第一列时,我需要使用 jquery 获取所有列行值?

谢谢

最佳答案

如果您希望将答案放在数组中:

$('table#mytable td:first-child').click( function(){
    var resultArray = $(this).closest('tr').find('td').map( function(){
        return $(this).text();
    });
    // Do something with resultArray
    // resultArray is a jQuery object
    // resultArray.get() is a plain array. get() can be chained above.
});

关于单击时的 jquery 列值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3015598/

相关文章:

javascript - JQuery Mobile - 关闭对话框后加载错误页面并且 Javascript 并不总是有效

javascript - 在多个页面上自动进行 javascript 和 html 测试

javascript - 基本的 jQuery 和 PHP Ajax 表单失败

php - 发布多个复选框值的数组

asp.net-mvc-3 - jquery $.post() 使用 Json() 返回 JSON

jquery - 无需编写多个函数即可调整多个 div 的大小

javascript - 使用最新的 jquery 版本时 JSON 是未定义的错误

jQuery select(live,change) 和 .ajax 仅触发一次

javascript - 查找前面没有任何内容、后面也没有任何内容的字符串

php - 使用 ajax jquery php mysql 检查用户名