Reputation: 17610
I want to be able to detect text that has been entered and display this back to the user by changing the color of specific words in a textarea. Much the same way as in Facebook or Twitter when a user enters a @username tag into a posting.
I want that word to be highlighted to the user before the post is submitted so that they are aware the application has acknowledged it.
What is the best way to achieve this kind of styling?
Upvotes: 1
Views: 390
Reputation: 172
Textarea elements do not allow styling:
<textarea><b>Hi</b></textarea>
Will not bold the text, it will display the html as text. Instead, try the contenteditable attribute.
Upvotes: 3