I have a script that when clicked will copy the contents of a div to the clipboard
<script type="text/javascript">
var program=document.getElementById('code');
ShowLMCButton(program.innerHTML, '', '', './static/js/lmcbutton.swf');
</script>
But when I click "Copy" it copies
<p>Line 1<br />Line 2</p>
Is there anyway to copy it like this:
Line 1 Line 2
` with `\n`. `textContent` does in fact join the contents into a single line. http://jsfiddle.net/542AF/ – bfavaretto Oct 02 '12 at 22:32