代码之家  ›  专栏  ›  技术社区  ›  MartinStettner

除第一行/最后一行/列之外的表单元格的jquery选择器

  •  23
  • MartinStettner  · 技术社区  · 14 年前

    有直接选择所有“内部”表格单元格的方法吗?( <td> 表(即所有单元格)的元素 除了 在第一行和最后一行和最后一列)中使用jquery选择器表达式?

    2 回复  |  直到 8 年前
        1
  •  56
  •   Nick Craver    14 年前

    :not() :first-child :last-child

    $('table td:not(:first-child, :last-child)')
    

    $('table tr:not(:first-child, :last-child) td:not(:first-child, :last-child)')
    
        2
  •  0
  •   saktiprasad swain    8 年前
     $('#table_name tr td:not(:first-child)').each(function () {
                        $(this).html('<input type="text" value="' + $(this).html() + '" />');
                    });