SVG is a nice for modern web pages. However, browser or framework support is sometimes… well, not that convincing.
Consider the following code:
Now you would like to programmatically “move” the .active class from one SVG to the other. One can do this easily with removing the active class from all elements first, and then add it to the new selection.
It should be easy. In MinifiedJS it should look like that:
jQuery 2 behaves similar:
But this won’t work on SVG as your JS framework needs to support it. Support for this is coming with jQuery 3 and hopefully for MinifiedJS too.
There is a workaround: just manipulate the actual attribute.
With MinifiedJS it would look like this:
With jQuery, it would be:
Tags: #JavaScript #jQuery #MinifiedJS #SVG