Javascript convert html to text with line breaks
Basically I just need the effect of copying that HTML from browser window and pasting it in a textarea element. Show For example I want this:
to become this:
asked Sep 28, 2010 at 13:26
Danylo MysakDanylo Mysak 1,5172 gold badges16 silver badges22 bronze badges 2 If that HTML is visible within your web page, you could do it with the user selection (or just a UPDATE 10 December 2012 However, the Demo: http://jsfiddle.net/wv49v/ Code:
answered Sep 28, 2010 at 13:57
Tim DownTim Down 310k72 gold badges445 silver badges521 bronze badges 13 I tried to find some code I wrote for this a while back that I used. It worked nicely. Let me outline what it did, and hopefully you could duplicate its behavior.
You could even expand this more to format things like ordered and unordered lists. It really just depends on how far you'll want to go. EDIT Found the code!
|