2017-01-19 77 views
0

我正在使用下面提到的代碼來動態創建複選框和標籤。但標籤和複選框不在同一行中排列。任何人都可以引導下面的代碼有什麼不對?複選框和標籤不在同一行顯示

dojo.require("dijit.form.CheckBox"); 
dojo.ready(function(){  
    var widgetNode = dojo.doc.createElement("DIV"); 
    chk = dojo.create("input", {id:"cbox", type:"checkbox"}, widgetNode); 
    lbl = dojo.create("label", {innerHTML:"Check me", "for":"cbox"}, widgetNode); 
    dojo.style(lbl, "marginLeft", ".5em"); 
var cbWidget = new dijit.form.CheckBox({}, chk); 
    cbWidget.startup(); 
    cbWidget.domNode.appendChild(lbl); 
dojo.place(cbWidget.domNode, "container"); 
}); 

回答