jQuery SVG, why can't I addClass?
问题 I am using jQuery SVG. I can't add or remove a class to an object. Anyone know my mistake? The SVG: <rect class="jimmy" id="p5" x="200" y="200" width="100" height="100" /> The jQuery that won't add the class: $(".jimmy").click(function() { $(this).addClass("clicked"); }); I know the SVG and jQuery are working together fine because I can target the object and fire an alert when it's clicked: $(".jimmy").click(function() { alert('Handler for .click() called.'); }); 回答1: Edit 2016: read the next