Skip to content

Instantly share code, notes, and snippets.

@Takazudo
Created March 5, 2011 15:09
Show Gist options
  • Save Takazudo/856419 to your computer and use it in GitHub Desktop.
Save Takazudo/856419 to your computer and use it in GitHub Desktop.
put the code of the very last script element into pre element.
function writeLastCode(){
var $s = $('script');
document.write('<pre></pre>');
var $pre = $('pre').last();
$pre.last().text($($s[$s.length-2]).text().replace(/\t/g,' ').replace(/\n/,''));
}
/*
use like following
<script>
alert('hoge');
</script>
<script>writeLastCode();</script>
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment