The problem statement over here is that I have a select list which is being populated by handlebar with the help of JSON data from server as shown in data_option variable and then there is other response from server store in data variable which is the actual data to be set for select list. As I have already specify the value while compiling data but still it doesn't selects the value and when I use Jquery to retrieve it throws empty.
<div class="make">
<script type="text/x-handlears-template" id="make">
<select class="options" value="{{id}}">
<option value="">--</option>
</select>
</script>
</div>
<script type="text/x-handlears-template" id="options">
{{#each option}}
<option value="{{id}}">{{name}}</option>
{{/each}}
</script>
<script type="text/javascript">
var data = {"id": 3};
var data_options = {
"option":[
{
"id": 1,
"name": "John Doe"
},
{
"id": 2,
"name": "James Don"
},
{
"id": 3,
"name": "John Don"
},
{
"id": 4,
"name": "James Doe"
}
]
}
var source = $('#make').html();
var template = Handlebars.compile(source);
$('.make').append(template(data));
var source2 = $('#options').html();
var template2 = Handlebars.compile(source2);
$('.options').append(template2(data_options));
</script>