It means the JavaScript code can not find the Anchor2 HTML element. This is either a misspelling error from your side, or, more probable, a timing issue for the JavaScript code from the HTML snippet.
if you Anchor2 is loaded after the HTML snippet code targeting that element, this error occurs.
It is tricky to fix this issue. Best is a custom widget for it, in that way both are loaded at the same time. Otherwise make sure the HTML snippet is loaded after the Anchor2 element, by placing it under it in the page in the Modeler. Does the Anchor2 object have conditional visibility on it? Those elements are somehow loaded last when rendering the page.
Just experienced this issue and like you guys said above, it’s likely caused by a spelling error. In my case, I’m using this widget in multiple places on my page and I misspelled the word ‘Tools’. Once I fixed this in the widget and on the class I was pointing it to, that fixed the issue. Hope this helps!
Thanks Ivo for the response.
I have tried loading HTML snippet after Anchor2 element. Yes, the anchor2 object have conditional visibility. As soon as the button is clicked it will get hidden showing some new content. Is there any other easy way other than custom widget as i am new to mendix and not implemented it.
Appreciate a quick response.
Thanks Salma
If it is conditionally visible I would go as follows:
The refresh of the DataView entity will trigger the context aware HTML snippet in reloading. Possibly add a minor timeout in the JavaScript code to make sure the code is fired after the page is loaded.