Can you manipulate DOM with javascript actions?

Hi there! Is it possible to use javascript actions to manipulate the DOM? I need to give styling to a DIV when it is selected, see image. I know you can do this with javascript normally but I’m not sure how to do this in Mendix?  What I have: What I want:
3 answers

To my knowledge, you cannot reference the DOM element that activated the JS action. So, you can target elements based on ID or class, but cannot target them based on where you clicked.

It may be the case that the element you clicked has focus after the click, and therefore you might be able to target it via:


If that doesn’t work, there are a few options:

  1. On click, use a nanoflow (or microflow) to set a reference between your clicked item and the context object. You can then use a conditional visibility expression on the container to show one version when the reference is set, and another when it is not.
  2. Use the HTMLSnippet widget to add JS in your container. You can reference the current element in that JS by using:



Have you checked the App Store for the Javascript module or similiar? With that you can add individiual HTML or JS code to a page.


Can I access css of the native app pages with the help of javascript actions dynamically on toggle of a button?

Say, I want to increase the font size of the app from 12 to 18 on toggling a button to “On” state with the help of a javascript action on native mobile?