How to highlight a text when dragged

I’d like to highlight the text and invert the color of text differently when it is dragged over.

Wix Studio Editor

What have you already tried:
Here’s the example: How To Change Text Selection Color with CSS
I want to apply this to a text box, but I’m not sure how to code CSS on velo.

Refer to this article for how to use CSS on Velo: Studio Editor: About CSS Editing | Help Center |

Yes, but not forgetting to tell → that this will work on Wix-Studio ONLY. :grin:
Else this will confuse those → who for example are using the ordinary Editor.

Thank you both! As russian-dima says, mine turned out not to be a Wix Studio Editor. (Sorry, I wasn’t really clear about the difference.) Apparently it was a Wix Editor. Could you help on this?

not sure if this will work in the classic editor as I havnt tested.

$w.onReady(function () {
    $w("#myTextBox").onMouseIn(() => {
        $w("#myTextBox").style.backgroundColor = "yellow"; // Change the background color to yellow
        $w("#myTextBox").style.color = "red"; // Change the text color to red

    $w("#myTextBox").onMouseOut(() => {
        $w("#myTextBox").style.backgroundColor = "white"; // Change the background color back to white
        $w("#myTextBox").style.color = "black"; // Change the text color back to black

Thank you for trying! I get this error “wix error property ‘style’ does not exist on type”. Do you know what it means?