I can't seem to copy and paste code form posts anymore. I get one big run-on line. The newlines no longer work. I also get all the line numbers, which means the code can't compile. Is there a "toggle plain text" option so I can copy and paste into an editor and run it?

Recommended Answers

All 16 Replies

Double-click on the code as if you were doing a Select All to copy and paste it.

OK, I do that and the line numbers go away, but I still have one massive line and I have to add a line return in an editor after every line. Does anyone else have to do this?

What thread are you talking about? (post the link to it). I have never seen that problem.

Does it just happen with one post? Maybe the poster typed it in as one massive line?

Bump. I can do it on Firefox and that's what I'll do from now on. Just wanted to know if anyone had the same problem on the copy and paste on IE 8.

Member Avatar for diafol

It's the view with IE8/XP rather than what's being posted. IE9/W7 shows fine as does Chrome etc. How about posting a screenshot?

Oooh I see what you mean. I am able to duplicate this problem in IE8 although it works fine in IE9. Looking into it ...

This is happening because we use jQuery's text() function to fetch the plaintext version. According to http://api.jquery.com/text/,

Due to variations in the HTML parsers in different browsers, the text returned may vary in newlines and other white space.

Does anyone know of a workaround?

Screenshot for linked thread.

Third time's a charm? Having problems uploading the screenshot.

EDIT -- I can't seem to simply attach it without putting it in the post itself. Hopefully you can see what I mean though.

Yes, so I see. I am able to duplicate this with IE7/IE8. Seems to work fine with IE9.

Member Avatar for diafol

Yep, .text() seems to be the culprit. The link you posted Dani has a /, at the end so it goes to an unknown page. However, reading through the comments, it seems that this is a known issue and has been for at least two years. I'm surprised jQuery have not remedied. Barius seems to have made some headway with this using .html() near the bottom of the discussion. I don't know whether this would be of any use.

Sorry for the broken link. html() has the same problem that text() does in old versions of IE.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.