Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

innerHTML and change color

Tags:

html

innerhtml

chatTextBox.innerHTML = '<span style="color:#FF0000"> hi </span>';

This is what I want to do, but the innerHTML just becomes

<span style="color:#FF0000"> hi </span> 

and not hi in red.

Note: I'm using a TextArea and I want to be able to write in multiple text color.

like image 496
PerfectAffix Avatar asked Oct 03 '22 14:10

PerfectAffix


1 Answers

chatTextBox.innerHTML = "<span style='color:#FF0000'> hi </span>";

try this way, it should ideally work.

like image 132
Krupa Gowda Avatar answered Oct 12 '22 10:10

Krupa Gowda