Underline text when clicking it - Problem

Hey there,
i got a simple text element which should get underlined when i click it. There is some code for similar problems in this forum but nothing worked so far. Can anybody tell me why?

$w.onReady(function () {
 //TODO: write your page related code here...
});

export function text1_click(event) {
let oldHtmlString = $w('#text1').html;
let newHtmlString = oldHtmlString.replace(/none/i, 'underline');
$w('#text1').html = newHtmlString;
}


It confused me pretty much that the same code is working pretty fine if its about the colour of the text:

$w.onReady(function () {
 //TODO: write your page related code here...
});

export function text1_click(event, $w) {
let oldHtmlString = $w('#text1').html;
let newHtmlString = oldHtmlString.replace(/#000000/i, '#FF0000'); //<--------
$w('#text1').html = newHtmlString;
}

Thanks for your help!

Where is your underline in the code?
https://www.wix.com/code/home/forum/community-discussion/how-to-use-onmousein-to-create-underline-on-a-tag-hover
https://www.wix.com/code/home/forum/community-discussion/text-underline-hover-effect

What about this part?

let newHtmlString = oldHtmlString.replace(/none/i, 'underline');

The second code was just to demonstrate that it works fine with a change in colours.