Changing text color based on dropdown choice in CMS template

Hi! How would I go about changing the color of a cms text field, but make it a different color depending on the value?

For example, my cms item has a form field with a choice of 'active and ‘inactive’. When this value is populated in the cms item template, if the value is ‘active’ I want it in green, if the value is ‘inactive’, then I want it red.

How can I make this happen? Thanks!

Here is my public share link: LINK
(how to access public share link)

HI @vitaliyg you can use a simple Javascript condition for it

!active ? red : green

This is very simple example but it can give an you idea how to solve it

1 Like