Returning rich text value when it has a paragraph break?

Hi there !

I have an if statement where I want to expand a module (“#InterviewModule0101”) if my text string is equal to ,
“How to get a similar job”,

The challenge is that the said text string has a line break and is read as ,
“How to get a
similar job”

I explored various options including the contains and html functions without success so far…

This line of code that works for a text string without a line break would be,
if ( $item ( “#interview01ModuleTitle” ). text === “How to get a similar job” ){
$w ( “#InterviewModule0101” ). expand ();
}

My latest attempt to make it work with a line break is the following but I get a “react is not defined” error,
if ( $item ( “#interview01ModuleTitle” ). html === < p class = “p3”>< span > How to get a < br />
similar job </ span ></ p >){
$w ( “#InterviewModule0101” ). expand ();
}

Would you know how to read this “rich text” string? Any help would be greatly appreciated ! :pray:

Hello! I fyou are using the rich text element, to retrieve the value as html, you want to use .value

For example this

Is retrieved like so…

$w('#richTextBox1').value

And will return this…

<p>Hello</p><p>THis</p><p>is</p><p>some </p><p>text</p>

Hi @amandam !

Thank you very much for your quick answer :pray:

I tested the this rich text input and I could not read its content either. I tried the following two approaches,

  • if($w ( ‘#richTextBox1’ ). value ===

    Hello

    THis

    is

    some

    text

    )

  • if ( $w ( “#richTextBox1” ). value === “How to get a similar job” )

In terms of background context, the challenge is that I’m using Editor X which only rich text seems to be an input field which I do not want to use… What I rather need is a regular text string to have a line break and for my Velo code to be able to read it. The said text string would be,
How to get a
similar job

So far, I can’t make it work with “.text” or “.html”; “.value” would not work on a regular text string. Do you think “.contains” may work somehow? I tried it on another page but it was related to a dataset rather than a plain text string…