jQuery SVG, why can’t I addClass?

Edit 2016: read the next two answers. JQuery 3 fixes the underlying issue Vanilla JS: element.classList.add(‘newclass’) works in modern browsers JQuery (less than 3) can’t add a class to an SVG. .attr() works with SVG, so if you want to depend on jQuery: // Instead of .addClass(“newclass”) $(“#item”).attr(“class”, “oldclass newclass”); // Instead of .removeClass(“newclass”) $(“#item”).attr(“class”, … Read more