How to dynamically create a drop down entry using dojo
var DD =dojo.byId("xyz");
var optn = document.createElement("OPTION");
optn.text="text"
optn.value="val"
DD.options.add(optn);
What will be the dojo equivalend开发者_StackOverflow中文版 of above js code?
use fallowing code to create a drop down entry dynamically:
dojo.addOnLoad(function () {
var select = dijit.byId("selBox");
select.addOption([{ label: 'newValue1', value: 'nv1' }, { label: 'newValue2', value: 'nv2'}]);
});
Full working example you can find here
精彩评论