I have a textarea. the value is inserted in the textarea on the click of a button
function addText(elId,text) {
if(document.getElementById("NewJudge").value != "")
{
var text_area_id = document.getElementById("hc_judge");
var judge_name =(document.getElementById("NewJudge").value + " , ") ;
var txt = document.createTextNode(judge_name);
text_area_id.appendChild(txt);
document.getElementById("NewJudge").value ="";
}
}
I used ',' to seperate values in the textarea. but the new values should be in a new line.
I searched the net and found that '& #13; & #10;' is used to add new line in textarea. But when I use this code
<pre lang="Javascript">
function addText(elId,text) {
if(document.getElementById("NewJudge").value != "")
{
var text_area_id = document.getElementById("hc_judge");
var judge_name =(document.getElementById("NewJudge").value + " & #13;& #10; ") ;
var txt = document.createTextNode(judge_name);
text_area_id.appendChild(txt);
document.getElementById("NewJudge").value ="";
}
}
</pre>
.
it keeps the text as it is.
i purposely put space between & # as it creates a new line here too :D
but when used in code it isnt working. Please help. Thanks in advance :)