Skip to content

Instantly share code, notes, and snippets.

@salcode
Created June 10, 2014 15:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save salcode/d9da9f6bbf62b0bc2702 to your computer and use it in GitHub Desktop.
Save salcode/d9da9f6bbf62b0bc2702 to your computer and use it in GitHub Desktop.
jQuery error_log() function that creates a div on the page and outputs the contents into it. Useful when troubleshooting IE8 javascript
// BEGIN DEV JS CODE for error_log
jQuery(document).ready( function($) {
$log = $('<div><h3>Log</h3></div>').css({
'position': 'absolute',
'top': 0,
'left': 0,
'width': 300,
'border': '1px solid red',
'background': 'white',
'color': 'black'
});
$('body').append( $log );
error_log = function( content ) {
$log.append( content + "<br>\n" );
}
});
// END DEV JS CODE for error_log
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment