Reputation: 89
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>
Upvotes: 2
Views: 2614
Reputation: 2482
.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.
Upvotes: 1