Skip to content

Instantly share code, notes, and snippets.

@akdetrick
Forked from furf/jQuery.document.write.js
Created July 2, 2012 18:34
Show Gist options
  • Select an option

  • Save akdetrick/3034787 to your computer and use it in GitHub Desktop.

Select an option

Save akdetrick/3034787 to your computer and use it in GitHub Desktop.
Deferred document.write
(function (document, $) {
document.write = function (text) {
var elem = $('script').last();
$(function () {
$('<div>').html(text).insertBefore(elem);
});
};
})(this.document, this.jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment