1

I have difficulty with finding a problem with jQuerys .addClass() function on an svg element

On this site I have an svg object like this:

<svg ... >
<polygon  class="maska mieszkanie" id="I9M01" ... />
<polygon  class="maska mieszkanie" id="I9M02" ... />
<polygon  class="maska mieszkanie" id="I9M03" ... />
...

In code below I have:

<script type="text/javascript">
    jQuery("#I9M01").addClass( "wolne" );
</script>

But I cannot force it to work. If I do jQuery("#I9M01").remove() it works, but I cannot add class and I don't know why. Is there any problem with svg elements?

Kaspar Lee
  • 5,446
  • 4
  • 31
  • 54
Barto
  • 469
  • 1
  • 6
  • 15

1 Answers1

2

As posted in jQuery SVG, why can't I addClass?

addClass doesn't work on svg.

You can use .attr('class', 'wolne')

Community
  • 1
  • 1
Carlo
  • 2,103
  • 21
  • 29