HTML Snippet - JS error

Hello,  I’ve just tried out the HTML snippet with all necessary HTML/CSS and JS data. I selected “HTML” in the widget. It is a simple DIV that has an “onclick” event. When running it in e. g. codepen it works fine but if I start running it in Mendix, it shows only the DIV I’ve created but nothing happens when clicking it. The following error is shown in the console: “Uncaught ReferenceError: Mother is not defined     at HTMLDivElement.onclick (index.html?profile=Responsive:1)”  Can anyone help me with this?  Thank you!
1 answers

According to your error, there’s a variable that your javascript is trying to reference called `Mother` that is undefined. It seems like your JS is running, but that there’s something amiss with your JS. If you share the JS snippet here we can help identify what that might be.

Additionally, if you’re attempting to implement a container (div) that has an on-click event, I’d suggest looking at the on-click event that exists on a container widget in Mendix. If you want to execute JS in this event, you can choose a nanoflow with a JS action.