Can I assign an Outsystem local variable to an HTML element class as value?

Can I assign an Outsystem local variable to an HTML element class as value?

  

Here's an HTML code:

SyntaxEditor Code Snippet

        <div class='myCustomClass'></div>
 

What I'm trying to do: 

SyntaxEditor Code Snippet

        <div class='"+OutsystemsLocalVariable+"'></div>


The reason I'm doing this is that I want to build an HTML class during runtime and I want it to be dynamic (using innerHTML). 

Is this achievable?

Hi,


Why do you think it's not achievable?

you can do it via expressions or via extended-properties for example



To J.'s point, with Expressions you would just adjust the escape property.  That said, I would highly encourage you to use extended properties instead to avoid any potential circumstance where the expression could break the HTML.  You simply add an extended property of 'class', and set the value to OutSystemsLocalVariable or such.

Solution

Hi Anthony,

Yes, it is achievable.

Please refer to below screenshot, try this way and you are able to set your class dynamically in div

 

Hope it will help you.


Thanks,

Rajat Agrawal


Solution

Thanks guys, your suggestions helped a lot. (: