Change container innerHTML onclick

0
Hi everyone! I’m trying to change the innerHTML of the following container:  This container (Name: container1) is inside a pop-up and has an onclick action. I’m using the action to change the container innerHTML… to do so, I’ve tried this: This code is called by a nanoflow onclick the container. When I click on the container, the action executes but it changes the mother page, in other words, it changes the main page. The following image shows what is happening: How can I change my container inside the pop-up instead of changing the mother page? Thanks in advance  
asked
3 answers
0

Based on the name of the javascript, it is likely that your goal is to change the background color of the container. Have you tried using dynamic classes? See https://docs.mendix.com/refguide8/common-widget-properties#dynamicclasses. These allow you to add a class depending on the value of an attribute.

 

answered
0

Hi Daniel,

Proved a class name to that container in appearance tab.

in JS use document.getElementsByClassName instead of TagName

hope it will be helpful for you.

answered
0

Hi Ivo and Javith. I added a class name to the container (“justa”) and wrote the code below.  It works but I got some errors.

But actually I think that dynamic classes would fit properly for me. I want to select a card in the list above and apply a class, highlighting the selected container. I have an entity called PaymentType, with an attribute called WasSelected(boolean). I created two classes inside visual studio(teste2 and teste3): 

How can I apply these dynamic classes? I tried Tim’s suggestion but I guess I don’t got it. I would be grateful if you could help me one more time. Thanks in advance!

answered