View Full Version : jQuery Internet Explorer Newline Issues

10-09-2009, 05:57 PM
I am building an application that uses jQuery to save the content of a textarea1. So, when you click the save link, it grabs the value of the textarea1 and puts it into another textarea2 from which you can copy the code to a .txt file on your computer. When you want to return your saved copy back to the textarea1 you copy from the .txt file into another textarea3 and click insert content. The jquery then parses out your input and reenters it into the textarea1.

My problem is this: Internet Explorer does not maintain the newlines but puts all the content onto one line when reentering the content. I need it to maintain the newlines just like Firefox and Chrome do.

10-09-2009, 08:50 PM
So this is a <textarea> you are using the collect the data? What happens if you just type a few lines by hand in a text editor, copy and paste it into the textarea? Isn't that essentially what you're doing? That works fine for me (ie7).

10-09-2009, 08:58 PM
I'll be getting the app online in a couple days which has this problem. Once I do, I think you will understand what I'm saying.

10-10-2009, 04:57 PM

I've got the app online so that it can be tested and get this issue rolled out.


First, tinker around with the app in firefox or any modern day browser and get a feel for how the save function works.

Then go and test the save function in IE of any version. You'll notice that it's not interpreting newline characters correctly and thus messes up the output immensely.

Once you understand the problem, any help or ideas on how to fix it are quite appreciated. I believe it has something to do with .html() filtering out newlines in IE.

Thanks in advance.