Created
October 25, 2013 10:49
-
-
Save Rockncoder/7152822 to your computer and use it in GitHub Desktop.
Generating the attributes of an option element.
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
// Render an option tag's value and selected attributes | |
hbs.registerHelper("option", function (current, field) { | |
current = hbs.Utils.escapeExpression(current); | |
field = hbs.Utils.escapeExpression(field); | |
var results = 'value="' + current + '" ' + (field === current ? 'selected="selected"' : ""); | |
return new hbs.SafeString(results); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A quick and dirty way to generate the attributes of an option element on the server-side with handlerbars.js.