[英]How to set a multi-line text to a field using jquery
我有多行的值,從php獲得,並且由於textareas的結構方式,我無法使用標准方式將其插入到textarea中。 所以我使用jQuery插入它,直到現在,它拋出一個錯誤。 有什么方法可以解決它,如果有的話,無需修改文本? 我看過很多地方,但沒有運氣..
$('textarea[name="data_form[question_79]"]').val('Hello member,
Some following messages goes on and on...');
這對我有用:
HTML:
<textarea name="data_form[question_79]"></textarea>
JS:
$('textarea[name="data_form[question_79]"]').val('Hello member, Some following messages goes on and on...\n\nthis is a new line');
FIDDLE: http : //jsfiddle.net/sCrqB/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.