Am using handlebar js to make a selectbox.
<select id="order_status_selection">
{{#each orders_status}}
<option value="{{id}}" {{#ifCond id status}} selected {{/ifCond}}> {{title}}</option>
{{/each}}
</select>
in js file am using a handlebar register
Handlebars.registerHelper('ifCond', function(v1, v2, options) {
if(v1 === v2) {
return options.fn(this);
}
return options.inverse(this);
});
i need to add selected tag when my id == status
when i execute this code outside the selectbox (in a div) the selected tag is printing but it doesn't print inside <option></option>
Am new to handlebar any advice will be helpful