I am using the object tag to embed svg's. I'd like to be able to set click events as well as changing things like the fill color on mouseover and mouseout. I understand that I can set the events from within the svg, but its very impractical when the svg is part of a navigation system etc.
<a id="{{id}}DatePickerBtn">
<object data="images/date-icon.svg" type="image/svg+xml" style="height: 100%;"></object>
<span class="block">Change Date</span>
</a>
Setting an event on the 'a' tag only fires when the span text is clicked, setting the event on the btn.getElementsByTagName('object')[0] doesn't work either.
I've scoured the internet looking for tutorials on interacting with svg's from javascript with no luck. Please no jQuery, I prefer vanilla JS.