开发者

Add span tags before and after the dojo filteringSelectWidget

I am trying to insert a tag before and a after this the dojo filteringSelect widget tag I just created. How can I do that in dojo?

<html>
<head>
    <script src="http://ajax.googleapis.com/ajax/libs/dojo/1.3/dojo/dojo.xd.js">
    </script>
    <script type="text/javascript">
        dojo.require("dijit.form.FilteringSelect");
        var filteringSelect = new dijit.form.FilteringSelect({
            id: "test"
        }, "test");
    </script>
    />
</head>
<body>
    <div aria-expanded="false" widgetid="test" role="combobox" class="dijit dijitReset dijitInlineTable dijitLeft dijitComboBox" id="widget_test" dojoattachevent="onmouseenter:_onMouse,onmouseleave:_onMouse,onmousedown:_onMouse" dojoattachpoint="comboNode" wairole="combobox" tabindex="-1">
        <div style="overflow: hidden;">
            <div role="presentation" class="dijitReset dijitRight dijitButtonNode dijitArrowButton dijitDownArrowButton dijitArrowButtonActive" dojoatt开发者_如何学编程achpoint="downArrowNode" wairole="presentation" dojoattachevent="onmousedown:_onArrowMouseDown,onmouseup:_onMouse,onmouseenter:_onMouse,onmouseleave:_onMouse">
                <div class="dijitArrowButtonInner">
                    ?
                </div>
                <div class="dijitArrowButtonChar">
                    ?
                </div>
            </div>
            <div class="dijitReset dijitValidationIcon">
                <br>
            </div>
            <div class="dijitReset dijitValidationIconText">
                ?
            </div>
            <div class="dijitReset dijitInputField">
                <input aria-owns="test_popup" value="United States" aria-required="true" tabindex="0" id="test" aria-invalid="false" aria-autocomplete="list" aria-haspopup="true" role="textbox" autocomplete="off" class="dijitReset" dojoattachevent="onkeypress:_onKeyPress,compositionend" dojoattachpoint="textbox,focusNode" wairole="textbox" waistate="haspopup-true,autocomplete-list" type="text"><input name="" style="display: none;" type="text">
            </div>
        </div>
    </div>
</body>
</html>


Well, if you absolutely want to split the definition of the FilteringSelect between your Javascript and HTML like that, I think you could do something ugly like:

var targetInput = dojo.byId("test");
var spanWrapper = dojo.create("span");

dojo.place(wrapperSpan, targetInput, "replace");
dojo.place(targetInput, wrapperSpan);

dojo.require("dijit.form.FilteringSelect");

var filteringSelect = new dijit.form.FilteringSelect({
    id: "test"
}, "test");
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜