在我们的代码,我发现下面一行: $("[^unitRow_]:checked")
它的工作原理确定,但我知道它应该是$("[id^=unitRow_]:checked")
没有:checked
我有语法错误,而不[^unitRow_]
我得到一些额外的值可以有人给我解释一下怎么运行的 ?jQuery选择开始奇怪的行为
$("[^unitRow_]:checked") returns
[
<input type="checkbox" disabled="disabled" checked="checked" class="global-item-selectAll" id="unitRow_x88ce13f5asda6f6_x5e8dasdaa60d76533" name="unitRow_x88ce13f5075a26f6_x5e8cc08dsad533" qualification="x5e8cc08a6sdad3" unitid="x88ce13f5075a26f6">
]
$(":checked")
[
<input type="checkbox" disabled="disabled" checked="checked" class="global-item-selectAll" id="unitRow_x88ce13f507as5a26f6_x5e8cc0dsa8a60d76533" name="unitRow_x88ce13fgfdg5075a26f6_x5e8cc08a6asd0d76533" qualification="x5e8fecc08a60d76533" unitid="x88ce13vref5075a26f6">
,
<option alt="Please select" selected="selected" style="width:110px;" title="Please select" value>Please select</option>
,
<option alt="Please select" style="width:110px;" title="Please select" value>Please select</option>
,
<option value="8" selected="selected">Sep</option>
,
<option value="2011" selected="selected">2011</option>
]
谢谢。
所有你需要的解释在这里:http://api.jquery.com/attribute-starts-with-selector/。如果您可以向我们展示您正在使用的HTML,我们可能会更好地发现问题。 – 2012-03-07 09:47:52