我的html代码如下。jQuery id选择器没有工作时有。在ID
<div id="chatbox_dipesh.parmar" class="chatbox">
//html markup which is validated
</div>
以上代码dipesh.parmar
div动态添加。
我正在使用以下代码访问它。
$("#chatbox_"+chatboxtitle).show();
其中chatboxtitle
是dipesh.parmar
,但它不是选择股利。
.
对于ID是否有效?
我的jQuery被加载并且与其他库没有冲突,并且将它包装到$(function(){ })
中。
谢谢。
逃生点。 参见此: [方向] [1] [1]:http://stackoverflow.com/questions/605630/how-to-select-html-nodes-by-id -with-jquery-when-the-id-contains-a-dot – Rob 2013-03-12 12:21:08
'$(“#chatbox_dipesh.parmar”)'将查找具有'id'作为'chatbox_dipesh'和'class'作为'parmar'的元素。 – arulmr 2013-03-12 12:23:18
@Rob快速完美的解决方案。 – 2013-03-12 12:24:04