【未解决】html中的a标签id与class冲突

来源:互联网 发布:北京好的编程培训机构 编辑:程序博客网 时间:2024/05/17 07:00

事情是这样子哒:

我本来写了个jquery的click动作,在使用选择器的时候,我想采用a标签的id,点击以后打开弹窗。然而这时候我把class样式也加在a标签里,结果不弹窗了。我用的浏览器是Firefox ESR 38.3.0版本。


代码如下:


HTML代码

<a href="#" id="test" class="testClass">test</a><div id="testDialog" style="display:none">    Username: <input id="usernameid" type="text"/></div>

jquery代码:

jQuery(document).ready(function() {$("#test").click(function(){$("#testDialog").dialog({width: 450,    height: 250,    button:{"Save":function(){},"Cancel":function(){}}});//end dialog}); //end test}); //end jquery


暂时解决方案:

把a标签里的class去掉以后,就弹窗了。如果实在要添加样式,就另外想办法吧。

如果要两全齐美,可以jquery的选择器使用class,不过估计会运用到所有相同class上面。



0 0