HTML just make a html, Javascript just execute java script. You can not put the script in HTML
Workable like this
If you have several languages in your app, check that all languages have the same javascript.
Also I dont believe you can add a source in that snippet, I was only able to run simple javascript.
If you need to add a library, (and therefore use the src = … functionnality), you have to add that library directly inside your index.html page (inside the theme folder)
Did you try to refresh the page while having your developer console open in Chrome (can be opened using F12). This will probably give some more details about the error.
the console log do not indicate any errors besides the “deprecated” entries:
Hi Sascha,
it could be, that your javascript snippet is executed, before the client has finished loading the entire page.
Best use mx.addOnload() to execute your script, after the client has finished loading. You can find some more information about it here: https://apidocs.rnd.mendix.com/9/client/mx.html
And one more thing: Your HTML/Javascript is set to HTML. Set it to Javascript and try again :)
Hi Alex,
If I switch over to Javascript the page shows an error: “Error while evaluating javascript input: SyntaxError: Unexpected token '<'”
Regarding mx.addOnload() can you please refer to a how-to as I’m pretty new to Mendix.
Thanks,
Sascha
Hi Sascha,
I would suggest you create a custom/pluggable widget for that. HTML/JavaScript widget has only some limited capabilities and for your usecase I think it is not the best solution. Have a look at this learning path to get you started https://academy.mendix.com/link/path/108/Build-a-Pluggable-Widget
Nevertheless I must admit, that this is not a simple solution.