travisbrown
Technical User
- Dec 31, 2001
- 1,016
How does one write a new line to the inner HTML of a textarea using js? \n is added to the string, but it displays in the textarea without breaking.
Code:
function addPO() {
var contact_pos = document.getElementById('contact_pos').innerHTML;
var po = document.getElementById('po').value;
alert(po);
if ( contact_pos.length != 0 ) {
document.getElementById('contact_pos').innerHTML = contact_pos + '\n' + po;
}
else
{
document.getElementById('contact_pos').innerHTML = po;
}
}