Skip to content

Instantly share code, notes, and snippets.

View EdJ's full-sized avatar

Ed EdJ

View GitHub Profile
@LukeChannings
LukeChannings / handlebars-select-helper.js
Last active March 29, 2023 12:45
A select helper for handlebars
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')
})