Header color changes when hover

Hi everyone, is it possible to change the header color when the mouse hovers on it?
if so, can someone write an example for the code i should use?

Thanks :slight_smile:

Hey Ron,
You can create an onMouse event - in the event you can write a code to set the html of the object.
For example :

 export function date_mouseIn(event) {
	$w("#element").html = `<h1 style = "color:red"> ${$w("#element).text}</h1>`;
}

In the example the color of the element will become red when you hover on it.
you can also check out this articles:

Hi Or,
thanks for your answer :slight_smile:
I tried adding the code to my page but I got an error:
“There was an error in your script
TypeError: e is not a function”

Hi ron,
Have you changed the (" #element ") to the specific item you want to change? if you did please send the site URL.

Hi
I’m trying to do the same thing. I copied the code and changed the #element, but it is saying unterminated string constant and cannot read property ‘type’ of undefined. Any ideas?
Thanks!

Hi Simone,
Did you add the event handler to the element ?
Let me know how it goes,
Roi Bendet

I used this code to change header to black, it didnt work
export function date_mouseIn(event) {
$w( “#header1” ).html = <h1 style = "color:black" > ${$w( "#header1).text}</h1>;
}

Im receiving this error :
Error parsing web-module ‘public/pages/c1dmp.js’: Unterminated string constant (3:56) while parsing file: public/pages/c1dmp.js

can u help please?

You are lucky :grin:
Miss Shaeffer is closing old posts :grin:

You should better open your own new POST, with your own old ISSUE :wink: