【问题标题】:Fetch inserted text inside 2 previous td using jQuery使用 jQuery 在前 2 个 td 中获取插入的文本
【发布时间】:2012-08-01 04:18:30
【问题描述】:

我在这样的表格中有多行 http://jsfiddle.net/mm6gF/1/
我想在消息中显示前 2 个 td 的内容。如何使用 jQuery 获取它?

【问题讨论】:

    标签: jquery fetch html-table


    【解决方案1】:
    $('.delete').click(function() {
        var name = $(this).closest('tr').find('td').first().text();
        var pw = $(this).closest('td').prev().text();
        answer = confirm ('Are you sure to remove this item?\n' + name + ' : ' + pw);
        if (answer)
        {
            alert('Removed');
        }
    })​;
    

    http://jsfiddle.net/mm6gF/2/

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2018-12-16
      • 1970-01-01
      • 2014-09-17
      • 2023-03-18
      • 1970-01-01
      • 1970-01-01
      • 2019-10-05
      • 1970-01-01
      相关资源
      最近更新 更多