JQuery template: how to access newly created option items in jquery template -
i have following json array need iterate through , create html option items using jquery template. problem have data might have duplicate values within each group. shown below a
can repeated in both groups.
"groups":[{//group 1 "names" : { "a" : "name1", "b" : "name2", } }, { //group 2 "names" : { "a" : "name1" } }//... ]
this how trying add options using jquery template.
<select id="select1" > {{each(groupindex, group) responsedata.groups}} {{each(index, name) group}} <option value="${name}" >${index}</option> {{/each}} {{/each}} </select>
but add a
twice option.
is there way access select element using id select1
, check if option value a
added using jquery template?
thank you.
better approach preprocess json array unique values , use them in jquery template.
Comments
Post a Comment