Javascript 如何找到不是所有单元格都用“填充”填充的第一行&;nbsp";用jQuery? 表名 COL1 COL2COL3COL4COL5COL6 某物某物某物某物某物某物某物某物某物某物某物

Javascript 如何找到不是所有单元格都用“填充”填充的第一行&;nbsp";用jQuery? 表名 COL1 COL2COL3COL4COL5COL6 某物某物某物某物某物某物某物某物某物某物某物,javascript,jquery,jquery-selectors,html-table,Javascript,Jquery,Jquery Selectors,Html Table,与上面一样,目标行应该是从顶部开始的第三行 顺便说一句,我不熟悉jQuery,$()。eq(0)选择第一个,如何排除第一个 $().ne(0)有效吗?这应该可以: <table id="experiences" cellpadding="0" border="1" width="100%"> <caption>table name</caption> <tr><th>col1</th><th>co

与上面一样,目标行应该是从顶部开始的第三行

顺便说一句,我不熟悉jQuery,
$()。eq(0)
选择第一个,如何排除第一个

$().ne(0)
有效吗?

这应该可以:

<table id="experiences" cellpadding="0" border="1" width="100%">
    <caption>table name</caption>
    <tr><th>col1</th><th>col2</th><th>col3</th><th>col4</th><th>col5</th><th>col6</th></tr>
    <tr><td>something</td><td>something</td><td>something</td><td>something</td><td>something</td><td>something</td></tr>
    <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
    <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
    <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
</table>
只需将#in替换为一个符号&。必须这样做才能在StackOverflow上显示它。

这应该可以做到:

<table id="experiences" cellpadding="0" border="1" width="100%">
    <caption>table name</caption>
    <tr><th>col1</th><th>col2</th><th>col3</th><th>col4</th><th>col5</th><th>col6</th></tr>
    <tr><td>something</td><td>something</td><td>something</td><td>something</td><td>something</td><td>something</td></tr>
    <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
    <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
    <tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>
</table>

只需将#in替换为一个符号&。必须这样做才能在StackOverflow上显示。

要选择大于第一行的所有行,可以执行以下操作:

function not_just_nbsp() {
    return $(this).html() !== "#nbsp;";
}

$("#experiences td").filter(not_just_nbsp).filter(":first").parent();

要选择大于第一行的所有行,可以执行以下操作:

function not_just_nbsp() {
    return $(this).html() !== "#nbsp;";
}

$("#experiences td").filter(not_just_nbsp).filter(":first").parent();

它是“在”,但不知何故被否定了。用于追加空间。它不会出现在代码中。您用:gt(0)gt排除第一个,gt是great than的缩写,那么排除第二个呢?gt(1)将丢失第一个$(“#experiences tr”)。gt(0)。dblclick似乎错误,双击现在没有响应。它是“ ;”in,但不知何故被排除。用于追加空间。它不会出现在代码中。你用:gt(0)gt排除第一个,gt是great than的缩写,那么排除第二个呢?gt(1)将错过第一个$(“#experiences tr”)。gt(0)。dblclick似乎错了,双击现在没有响应。我不理解你的代码,它会选择第三行作为最终结果吗?它会在列中检测到超过1个空格吗?它会查找所有表单元格,过滤掉其中只有一个空格的单元格,选择剩余单元格中的最后一个,然后查找父表行。在您的示例中,它将选择第4行的第二个tr。@phoenix:如果您想排除所有只有空格的表单元格(与有空格的表单元格相反),则可以在筛选函数中使用regexp。为什么使用$(this).html()!==" "; 而不是$(this).html()!==“”?我不理解您的代码,它会选择第三行作为最终结果吗?这会在列中检测到超过1个空格吗?它会查找所有表格单元格,过滤掉其中只有一个空格的单元格,选择剩余单元格中的最后一个,并查找父表格行。在您的示例中,它将选择第4行的第二个tr。@phoenix:如果您想排除所有只有空格的表单元格(与有空格的表单元格相反),则可以在筛选函数中使用regexp。为什么使用$(this).html()!==" "; 而不是$(this).html()!==“?$('.yourClass').gt(0)$('.yourClass:gt(0)”是相同的吗?啊,对不起。。。这里很晚了。修正了。$('.yourClass').gt(0)$('.yourClass:gt(0)')是相同的吗?抱歉。。。这里很晚了。固定的。