Hi, community. I’d like users to enter text into a simple input field that goes to a database – but then when that text is displayed later on a different page, I’d like the first two words to appear in one font, and the words after the second word to appear in a different font.
I’ve not been able to achieve this effect. Can it be done without code? Thanks!
set the html value of the texted to the styled result
Here’s how an example for code would look like:
let text1 ="the text you want from the database";
let textArr = text1.split(' '); // it will have all the words
let finalText = "";
textArr.forEach((word, i) => {
if (i > 1) {
finalText = finalText + " " + word
}
})
finalText = "<p> <font style= 'color:Red'>" + textArr[0] + " " + textArr[1] + " </font>" + finalText + '</p>';
$w('#text1').html = finalText;
Thank you. As a non-coder, this is beyond my comprehension.
In the first line of code, how would “the text you want from the database” get handled automatically? I have an always-updating database and need the formatting to be automated. Is this possible? Thanks!