0
alert($("#bottomTbodyTable tr [data-testlog]").length); // display value 0
alert($("#bottomTbodyTable tr").data("testlog")); // display the correct value

在这个属性的显示过程中有明确的值时,我无法理解值 0。

4

1 回答 1

3

你可能想要

$("#bottomTbodyTable tr[data-testlog]").length

这与 和 之间没有空格是相同的tr[data-testlog]空格意味着具有 data 属性的元素将是 的后代tr

于 2013-04-15T18:26:42.067 回答