Skip to Content
avatar image
Former Member

how to apply two css classses to FORMATEEDTEXTVIEW component ?

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Nov 16, 2017 at 01:25 PM

    This is how I managed to do it:

    1. on-startup script:

    2. CSS :

    3. Assign css class to component:

    4. Voila !!

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      Sorry for late reply. Thanks for solution.

      I have done something similar

      '<p> <span class ="Pagetitle"> Title   </span>  <span class ="Pagesubtitle"> subtitle</span>  </p>  ' ;
  • Sep 18, 2017 at 10:57 PM

    Hi Pramod,

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

    FORMATTEDTEXTVIEW_1.setCSSClass("colorblue colorred")

    Regards,

    Mustafa.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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