New line constant with text variable

hello

I am trying output some text from a function to a text node using:

let var1 = "";

var1 = var1 + "new text \r \n";

var1 = var1 + "new text 2 \r \n";

msg.payload = var1;
return msg;

It works fine and var1 displays in the text node, but I need it to add a new line constant between new text and new text 2, so far I am seeing all new text and new text 2 on the same line

Any thoughts?

Hi @Sirhc

Which text node are you referring to? Is this Node-RED Dashboard? FlowFuse Dashboard? Or something else entirely?

This is in the node red dashboard, using the text node.

Ok, I don't really know, but I thought it was <br> for new line.

(Sorry, I'll go away)

Ah it is
! thank you very much!

If it was me, please mark it to help anyone else with the same problem.

Just a comment that instead of

let var1 = "";
var1 = var1 + "new text";
var1 = var1 + "<br>";
var1 = var1 + "new text 2";
msg.payload = var1;

Your function could be

msg.payload = "new text" + "<br>" + "new text 2"
2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.