I am trying to develop an interactive SVG map and I want to do stuff when the mouse enters rectangles within the SVG image. Currently, the code logs to the console when my mouse enters the SVG image, but not when I mouse over the rectangles. Any help would be much appreciated. Thanks!
<object onload="svgOnLoad()" id="activeSVG" data="SVGNAME.svg" type="image/svg+xml">
</object>
<script>
function svgOnLoad() {
console.log("SVG Loaded");
$("#activeSVG").mouseenter(function(e) {
console.log("In the SVG")
});
//Executed when the mouse enters an SVG rect element
$("rect").mouseenter(function(e) {
console.log("Mouse Entered rectangles!!")
});
}
</script>