Reputation: 15
My jsp has the following text area:
<textarea rows="5" cols="30" id="pasted_values"
class="cell98 h15"></textarea>
onload of page, im dynamically setting the content this way:
$('#pasted_values').text(pastedValuesText);
But on page load, the text area is shown empty. But inspect element, HTML and DOM content for the text area element show the value present.
Tried using .val(). But it only seems to work through js the sandbox js console in firebug. Tried using the textarea shortcut i.e
<textarea rows="5" cols="30" id="pasted_values"
class="cell98 h15" />
But the above distorts other UI for some strange reason.
Please help.
Upvotes: 0
Views: 1852
Reputation: 1768
It seems to be working http://jsfiddle.net/ECFcR/
<textarea rows="5" cols="30" id="pasted_values"
class="cell98 h15"></textarea>
$('#pasted_values').text('Hello World!');
Is the colour in the textarea the same as background?
What is the value of pastedValuesText?
Upvotes: 0
Reputation: 6933
Textarea behaves like other html fields after the page is loaded.
$('#pasted_values').val(pastedValuesText);
Or
document.getElementById('pasted_values').value = pastedValuesText;
Upvotes: 2