Hi,
I want to change the font colour inside text box elements on mouse in and mouse out etc.
Is there a way of specifying multiple text box element ids and changing them all in the same function or do you have to code for each and every element (repeat over and over again)?
I.e. have to repeat this code below again and again…or is there a better way if dealing with multiple text boxes?
$w.onReady(function () {
$w(’ #text1 ‘).onMouseIn(()=>{hoverTxt();});
$w(’ #text1 ‘).onMouseOut(()=>{unhoverText();});
});
function hoverTxt(){
let oldHtmlStr = $w(’ #text1 ‘).html;
let newHtmlStr = oldHtmlStr.replace(/ #E0760D /i, ‘#402858’);
console.log(newHtmlStr);
$w(’ #text1 ‘).html = newHtmlStr;
}
function unhoverText(){
let oldHtmlStr = $w(’ #text1 ').html;
let newHtmlStr = oldHtmlStr.replace(/#402858/i, ’ #E0760D ‘);
console.log(newHtmlStr);
$w(’ #text1 ').html = newHtmlStr;