cancel
Showing results for 
Search instead for 
Did you mean: 

how to apply two css classses to FORMATEEDTEXTVIEW component ?

former_member195433
Participant
0 Kudos
787

Can i apply two CSS classes to one FORMTTEDTEXTVIEW component ?

I need to achieve two different colors for a single single sentence and show it on a FORMATTEDTEXTVIEW .

I have tried the following html text and i have defined two css classes in 'colorblue' and 'colorred' in css file

<p class="colorblue"> Some text <p>

<p class="colorred"> Another text :)</p>

var html =  '<p> Some text <p> <p> Another text :)</p>';
FORMATTEDTEXTVIEW_1.setHtmlText(html); 

I dont want to use two Components as text is dynamic and length isnt constant .

" This a string text which i need in two different colors and its dynamic "

Thanks,

Pramod

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

This is how I managed to do it:

1. on-startup script:

2. CSS :

3. Assign css class to component:

4. Voila !!

former_member195433
Participant
0 Kudos

Sorry for late reply. Thanks for solution.

I have done something similar

'<p> <span class ="Pagetitle"> Title   </span>  <span class ="Pagesubtitle"> subtitle</span>  </p>  ' ;

Answers (1)

Answers (1)

MustafaBensan
Active Contributor

Hi Pramod,

Did you try executing the following script code to apply the CSS?:

FORMATTEDTEXTVIEW_1.setCSSClass("colorblue colorred")

Regards,

Mustafa.

former_member195433
Participant
0 Kudos

Mustafa,

I have tried that but it didnt work me. I was initially using color attribute in html tag which didn't yield any results and finally end up using Span and CSS attributes to get it work.

thanks

Pramod