7
Views
2
Comments
Solved
Can I execute logic inside an SVG?
Application Type
Reactive

Hi there.

I have an SVG file, which I want to place on a screen of my application. I placed some JavaScript code inside of this SVG file using a <script> tag. I placed this SVG on my screen using an Image widget.

However, when I run the application, it's like the JavaScript code I wrote in there was ignored. Is there any way I can solve this? Or, maybe, is there another way to approach this? Maybe place the JavaScript code outside of the SVG?

Any help would be appreciated :)

Rank: #2824
Solution

Hi. Thanks for your reply, I kept trying and eventually figured it out :)

I simply placed my SVG file inside of an <object> tag instead of an Image widget and my logic worked. 

Rank: #515

Hi Yizuhi,

Yes, it's possible to execute logic inside an SVG using javascript. Could you send me the svg file or the javascript that you are trying to use?

Best regards

Rank: #2824
Solution

Hi. Thanks for your reply, I kept trying and eventually figured it out :)

I simply placed my SVG file inside of an <object> tag instead of an Image widget and my logic worked.