使用' \n '换行,而不是'\n' 注意前后空格

实战demo:

$('#text').val('hello' + ' \n ' + 'world');