JavaScript UI Libraries & Blazor Components Suite – Smart UI › Forums › Window › Adding text to Window with
I need to use a window to show some text.
The text is produced dynamically and then I can’t create it as static html text.
I tried using innerText and it works.
However, sometimes, when the text should contain a cr/lf in order to be better formatted.
I tried with <br/> and with /r/n but none worked.
How can I do that ?
Tks
Hi,
To put HTML instead of Text, you need to use innerHTML, not innerText.
Regards, Markov
Smart UI Team https://www.htmlelements.com/
Sorry but it doesn’t seem to work.
With the following js code the window appears empty with any message I can use (also “Bye”).
const window = document.createElement(“smart-dialog-window”); window.innerHTML= message;
If you need to dynamically update the content of a window, you should use the updateContent method.
It works but the HTML is still not understood and <br/> is not interpreted as carriage return.