Sunday, June 23, 2013

jQuery textarea append newline behavior

You use the jQuery val method, \n works consistently in Firefox and IE (Including IE8):
var txt = $("textarea#idhere");
txt.val( txt.val() + "\nSomething here\n\nAgain");

No comments:

Post a Comment