Last active
January 12, 2016 12:02
-
-
Save viankakrisna/a20881ac1c03788f55a6 to your computer and use it in GitHub Desktop.
This is a jQuery plugin for dumping variable to a JSON string.
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 ($) { | |
$.fn.dump = function (variable) { | |
this.html($('<pre></pre>') | |
.text(JSON.stringify(variable, null, 4))); | |
return this; | |
}; | |
})(jQuery); | |
//How to use: | |
/* | |
var test = { | |
foo: bar | |
} | |
$('#foo').dump(test); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment