gpt4 book ai didi

dojo - dojo.query() 返回什么?

转载 作者:行者123 更新时间:2023-12-04 14:36:46 31 4
gpt4 key购买 nike

我刚刚开始使用道场,我知道 dojo.query$ 相同在 jQuery 中。

但我还没有弄清楚它返回什么。它是像 jQuery 一样的专门对象吗?

我正在尝试做的(没有运气)是:

dojo.query("output").innerHTML = data;
//this doesn't work either:
dojo.query("output").html(data);
//tried accessing by id as well
dojo.query("#output").html(data);
//and tried to access a div, incase dojo has some issues with html5 elements
dojo.query("#divOutput").html(data);

我目前正在使用新的 html5 elements :
<output id="output">Output goes here</output>
<div id="divOutput">non-html5 output goes here</div>

而且我似乎找不到关于如何处理 dojo.query() 返回的对象的好列表。 ..

编辑:好吧,我认为道场现在只是在惹我。我找到了这个方法: addContent()这适用于上述选择器。但是我不想添加内容,我想替换内容......

最佳答案

查询方法返回一个 NodeList 对象。

NodeList 的引用文献中您可以找到可应用于该列表的功能列表
的元素。该列表没有innerHTML 函数,但html 函数应该可以工作。

HTML 中没有“输出”元素,也许您尝试使用类名“输出”来定位元素?

dojo.query(".output").html(data)

还是 ID 为“输出”的元素?
dojo.query("#output").html(data)

关于dojo - dojo.query() 返回什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1542641/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com