我必须有包含点的类,但是 jQuery 不起作用。我应该怎么办? 示例:http://jsfiddle.net/9KYmx/
<div style="display: none" class="dfv.png">
text
</div>
$(document).ready(function() {
$('.dfv.png').show();
})
附注ID 也不起作用。
最佳答案
你需要逃离他们。来自 the manual:
If you wish to use any of the meta-characters
( such as !"#$%&'()*+,./:;<=>?@[\]^`{|}~ ) as a
literal part of a name, you must escape the character
with two backslashes: \\. For example, if you have an
element with id="foo.bar",
you can use the selector $("#foo\\.bar").
关于javascript - 当元素的类或 ID 包含点时,无法显示该元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5861122/