how to create function to change text color onMouseIn ?

Hello
I know it’s stupid question but,
I have a few text elements which I want to create one function for all, instead several of the same function for each.
I just want when that onMouseIn the color will be green
and when onMouseOut the color will be back to black

how do I write this?
thank you!

Hello!

The style attribute of text elements supports the color property among other ones.

Check out our API reference, section ‘Inline styling’: https://www.wix.com/corvid/reference/$w.Text.html#text

This means that you can assign the value of your input to the style attribute and hence change the text color when your users input their value.

Check out posts on a similar matter:
https://www.wix.com/corvid/forum/community-discussion/change-text-color-on-mousein
https://www.wix.com/corvid/forum/community-discussion/change-the-text-color-on-click (this one can still be helpful since the only difference is an event handler used)

And here is an example on selecting elements:
https://www.wix.com/corvid/reference/$w.html