Created
February 15, 2012 04:20
-
-
Save craigmccoy/1833164 to your computer and use it in GitHub Desktop.
A simple plugin for turning a textarea into a debug message window.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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