javascript - New lines in textarea doesn't work in IE -


for ie, tried several ways add new lines in textarea without success.

html

<textarea name="mytextarea" rows=4 cols=4 maxlength=250></textarea> 

javascript

var text= "line1 line2 line3";               text= text.replace(/\s/g, "\r"); $('textarea[name=mytextarea]').val(text); 

update

i tried remove css associate textarea , work.

textarea{    white-space: nowrap;  } 

the problem cannot display words in same line without breaking them. requires question

your code works fine. tried in ie: http://jsfiddle.net/yo6cc45g/

the problem set cols=4 , line1 contains 5 characters, therefore number appear in new line. change cols attribute 5 , ok.

<textarea name="mytextarea" rows=4 cols=5 maxlength=250></textarea> 

Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -