jQuery:如何引用其类名带有句点的HTML元素? [英] jQuery: how to reference an HTML element whose class name has a period?
本文介绍了jQuery:如何引用其类名带有句点的HTML元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我以这种方式有几个要素<td class="sede_co.uk">
I have several elements in this way <td class="sede_co.uk">
我想通过jquery这样引用它们:
I want to reference them using jquery this way:
$(td.sede_co.uk)
但是jquery不会找到"它们,因为(我想)"co"和"uk"之间的点.
but jquery doesn't "find" them because (I guess) the point between "co" and "uk".
有什么主意吗?
致谢
哈维
推荐答案
您应该修复无效的类名...但是要按原样查询,请逃避.
:>
You should fix the invalid class name...but to query for it as is, escape the .
:
$("td.sede_co\\.uk")
您可以在此处进行测试.不过,请务必修复该类,因为.
在类名中不是有效字符,它将减少麻烦.
You can test it here. Please do fix the class though, .
isn't a valid character in a class name...it'll cause fewer headaches.
这篇关于jQuery:如何引用其类名带有句点的HTML元素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文