0

I'm trying to unhide an SVG image from my page with jQuery. The code is:

if ( slotNumber == cardNumber ) {
    $('#bub3').attr("class", 'bub3');
    $('.bub3').removeClass("hidden");
    ...
    }

My SVG looks like:

<svg class="hidden" id="bub3"
width="1200" height="120" 
     viewPort="0 0 120 120" version="1.1"
     xmlns="http://www.w3.org/2000/svg">
<polyline   
        class="path "
        stroke-linejoin="bevel"
        points="20,100 60,20, 350,20"
        stroke="black" 
        stroke-width="2"

<path d="M20 100 L60 20 L350 20 Z" />
/>
</svg>

I know, that removeClass() does not work with SVG, that's why I'm trying with attr("class", "bub3"), but that does not seem to work either. The SVG stays hidden. removeAttr("class") works, but I want to keep certain classes, not get them all removed.

Any ideas why attr("class", "bub3") does not work?

lte__
  • 7,175
  • 25
  • 74
  • 131
  • Have you had a look to **all** the [answers](http://stackoverflow.com/a/15821713/2788131)..? – D4V1D Jul 29 '15 at 09:59
  • Yes. This still does not solve the issue, since I want it to work on IE, too, and "IE does not implement .classList and API on SVG Elements". Also, this still does not answer why `attr()` wouldn't work, even though that is the solution I've read about on multiple pages. – lte__ Jul 29 '15 at 10:11
  • @D4V1D - this is not a duplicate. Those answers don't apply in this case. That's why I asked the question in the first place. – lte__ Jul 29 '15 at 10:17

0 Answers0