Does anyone know how I could change the color of a specific word if it is typed into a textarea? For instance, if the user types 'hello my friend', it would dynamically change 'hello' to green? Spent a large amount of time on google, and could not find anything very related. Thank you.
textarea
s aren't designed to be selectively colored.
You can't do it in a textarea field because its only content can be text, not HTML. You'll have to use an editable DIV or something, and then replace the word in string with <span>word</span>
and apply a CSS class to the SPAN.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With