"); And ...">

JQuery IE7 Id append issue

So, I have the following jQuery

    $j("a#Pinterest").html("<img src='/images/Social Media/pinterest.png'>");

And the markup is as follows:

<a id="Pinterest"></a>

Which works fine, but the user has the ability to add several to one page, and I noticed that in IE7 only the first anchor receives the attached image, and not the others. In all other browsers, they all get an image.

Any ideas?

+3
source share
2 answers

HTML

<a class="Pinterest"></a>
<a class="Pinterest"></a>

Js

$j("a.Pinterest").html("<img src='/images/Social Media/pinterest.png'>");

The identifier must be unique, but you can use the class for a group of elements using the same class name.

+2
source

idmust be unique on the html page. You can use the same identifier once. Use the attribute instead class.

+6
source

All Articles