Jquery IE7 Id追加问题
所以我有以下JqueryJquery IE7 Id追加问题,jquery,css,Jquery,Css,所以我有以下Jquery $j("a#Pinterest").html("<img src='/images/Social Media/pinterest.png'>"); $j(“a#Pinterest”).html(“”); 加成如下: <a id="Pinterest"></a> 这很好,但是用户可以选择在一个页面中添加多个,我注意到在IE7中,只有第一个锚点连接了图像,而没有其他锚点。在所有其他浏览器中,它们都会附加图像 有什么想法吗
$j("a#Pinterest").html("<img src='/images/Social Media/pinterest.png'>");
$j(“a#Pinterest”).html(“”);
加成如下:
<a id="Pinterest"></a>
这很好,但是用户可以选择在一个页面中添加多个,我注意到在IE7中,只有第一个锚点连接了图像,而没有其他锚点。在所有其他浏览器中,它们都会附加图像
有什么想法吗?
id
在html页面上必须是唯一的。同一个ID只能使用一次。改用类属性。HTML
<a class="Pinterest"></a>
<a class="Pinterest"></a>
JS
$j("a.Pinterest").html("<img src='/images/Social Media/pinterest.png'>");
$j(“a.Pinterest”).html(“”);
Id应该是唯一的,但您可以对使用相同类名的一组元素使用class。页面中是否有“”的多个副本?是的,这就是我所暗示的。:)