Created
April 17, 2012 18:27
-
-
Save charliewilson/2408008 to your computer and use it in GitHub Desktop.
A tiny jQuery plugin used in conjunction with mustache.js to interpret mustache code at runtime on specific elements.
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
// Usage: | |
// | |
// $("body").mustache(view); | |
// | |
// where 'view' is a mustache view object. | |
(function( $ ){ | |
$.fn.mustache = function(viewobj) { | |
var elementtext = this.html(); | |
var output = Mustache.render(elementtext, viewobj); | |
this.html(output); | |
return this; | |
}; | |
})( jQuery ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment