2

Is there a way to add different colors to the objects below... the way I'm doing is not working when I output to a textarea.

//Print out InputTextToSave 10
                document.getElementById('inputTextToSave10').innerHTML= 
                "Name" + "\n" + studentname.fontcolor("red").bold()
                + "Number " + studentnumber.fontcolor("blue").bold();

<textarea id="inputTextToSave10" style="width: 1300px; height: 857px; 
background-color: #333333; font-family: Arial; font-size: small; font-
weight: normal; color: #FFFFFF;"></textarea>
Alexa Atna
  • 89
  • 1
  • 8

1 Answers1

1

.textarea_type_div{
  width: 1300px; 
  height: 857px; 
  background-color: #333333;
  font-family: Arial; font-size: small; 
  font-weight: normal; 
  color: #FFFFFF;
}

.textarea_type_div .studentname{
  font-weight:bold;
  color:red;
}

.textarea_type_div .studentnumber{
  font-weight:bold;
  color:blue;
}
<div class="textarea_type_div" contenteditable="true">
  <span class="studentname">Student Name</span>
  <span class="studentnumber">Student Number</span>
</div>

Instead of textarea you can make a div and give that div a property called contenteditable="true" and in that you can write and change the text color as per your need.

You can refer this link for more help

Also, You can use texteditor plugin such as The Yahoo RTE, the FCKEditor and the Lightweight RTE.

Hope this helps.

Bhavin Shah
  • 2,462
  • 4
  • 22
  • 35