I am trying to call a function from an external javascript file on an "onmousedown" attribute of an SVG element, which works just fine in Edge, Chrome, and Firefox, although Internet Explorer reports that the function is undefined.
I have already tried couple of things, such as wrapping the method inside jquery in $(document).ready, setting an 5 second timeout before calling the function, but nothing seems to work here. Is this a limitation of SVG elements in Internet Explorer, or i'm missing something? My basic code seems like this:
<script src="~/Scripts/myexternalscript.js"></script>
<script>
function MyFunction(evt) {
MyExternalFunction(evt); //Defined in the myexternalscript.js
}
</script>
<div>
<svg onmousedown="MyExternalFunction(event)" id="SvgjsSvg1001" width="100%" height="100%" xmlns="http://www.w3.org/2000/svg" version="1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svgjs="http://svgjs.dev/svgjs"></svg>
</div>
My internal function looks like:
function MyInternalFunction(evt){
...
}
But i already tried other forms, like:
MyInternalFunction = function(evt){
...
}
Thank you for any advice!