Skip to content

Instantly share code, notes, and snippets.

@craigmccoy
Created February 15, 2012 04:20
Show Gist options
  • Save craigmccoy/1833164 to your computer and use it in GitHub Desktop.
Save craigmccoy/1833164 to your computer and use it in GitHub Desktop.
A simple plugin for turning a textarea into a debug message window.
(function($) {
$.log = function(context, message/*, ...*/) {
if(context.is('textarea')) {
if(arguments.length > 2) {
for(var i = 2; i < arguments.length; i++) {
message += ', ' + arguments[i];
}
}
var contents = context.val();
context.attr('readonly', 'readonly').val(contents + "\n" + message);
}
});
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment