Can you add html to an IF expression?

Can you add html styling to an expression such as
{{trading_name != NULL ? <b>' t/a '</b> + trading_name : ''}}
where I am trying to style the t/a as bold?

Or is this the only way to do it?
<b>{{trading_name != NULL ? ' t/a ' : ''}}</b>{{trading_name != NULL ? trading_name : ''}}

Or is there an alternative way?

Better off just showing the HTML if true, like
<p dmx-show="trading_name"> <strong> t/a </strong> {{trading_name}}</p>

2 Likes

Yeah, thought as much. I have got this at the moment (slightly different to original post)

<p dmx-hide="trading_name"><b>{{business}}</b></p>
<p dmx-show="trading_name">{{business}} t/a <b>{{trading_name}}</b></p>

which is straight forward and easy to read.

2 Likes

Just read https://developer.mozilla.org/en-US/docs/Web/HTML/Element/strong and I was wrong when I wrote <strong> in my reply.

1 Like

I’ll let you off, it must be late in the day for you :sleeping:

Another couple of hours and I’ll be off for a few :beers: :smile:

I didn’t realise that it was so obvious that I already had my share of :beers: :sunglasses:

1 Like

F1 qualifying is starting. :racing_car: This is it for tonight.

I lost interest in F1 years ago, so just :beers: and :soccer: for me today

1 Like