문제

Div의 끝까지 Dijit을 만들고 추가하는 방법이 있습니까? 다음 코드가 있다고 말합니다.

<div id="attendants">
</div>

<button dojoType="dijit.form.Button" onClick="addPerson();">Add Person</button>

온라인으로 다음 코드를 찾았지만이 코드는 내 '승무원'DIV를 대체합니다.

var personCount = 0;
function addPerson() {
    personCount += 1;
    var attendants = dojo.byId('attendants');
    var newField   = new dijit.form.TextBox({id: 'newPerson' + personCount, name: 'newPerson' + personCount}, attendants);
}

그리고 DIV를 DIJIT로 바꾸지 말고 DIV에 새로운 TextBox Dijit을 동적으로 추가하고 싶습니다.

도움이 되었습니까?

해결책

정답은: dijit._widget.placeat

// place a new button as the first element of some div
var button = new dijit.form.Button({ label:"click" }).placeAt("wrapper","first");
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top