Forum Moderators: open

Message Too Old, No Replies

Question: when is browser done reformatting wrapped text in textarea

         

gbeddow

9:16 pm on Nov 3, 2009 (gmt 0)

10+ Year Member



In JavaScript, how do you detect when the browser is done re-formatting text in a textarea that has line wrap turned on? I've found, especially after pasting a large chunk of text, that the browser continues to re-format & wrap the text long after typing stops. Is there an event of some sort you can look for when it's done? Thanks, Greg

Fotiman

9:59 pm on Nov 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Welcome to WebmasterWorld!
I'm not sure what you mean by "has line wrap turned on"? A textarea will always wrap lines.

As for a specific event, there is nothing specific to a text area. If you are cutting and pasting, you could maybe listen for the keyup event and see if it was a CTRL+V, but that wouldn't catch cases where you select Edit > Paste in the browser menu.

Side note, I've never seen any behavior like what you describe.

Demaestro

10:42 pm on Nov 3, 2009 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



I have never heard of such a thing either. But if you are experiencing a textarea that is firing events after a paste has taken place then you can try the onBlur event.

Although if there are multiple events being fired then it may get called more than once per paste so you might have to do some checking to see what is happening.

gbeddow

10:47 pm on Nov 3, 2009 (gmt 0)

10+ Year Member



>A textarea will always wrap lines.

Setting the CSS white-space property to nowrap will turn off line wrap.