Forked from LukeChannings/handlebars-select-helper.js
Last active
August 29, 2015 14:07
-
-
Save shorttompkins/6a87d544ff4409b99e7b to your computer and use it in GitHub Desktop.
This file contains hidden or 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
Handlebars.registerHelper("select", function(value, options) { | |
return options.fn(this) | |
.split('\n') | |
.map(function(v) { | |
var t = 'value="' + value + '"' | |
return ! RegExp(t).test(v) ? v : v.replace(t, t + ' selected="selected"') | |
}) | |
.join('\n') | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment