开发者

Dojo.NodeList.append()

开发者 https://www.devze.com 2023-02-01 22:29 出处:网络
This function is giv开发者_运维问答ing me trouble running something similar to the example provided at: http://dojotoolkit.org/api/1.5/dojo/NodeList#append

This function is giv开发者_运维问答ing me trouble running something similar to the example provided at: http://dojotoolkit.org/api/1.5/dojo/NodeList#append

My attempt:

<div class = "foo"><p>Hello Mars</p></div>
<div class = "foo"><p>Hello World</p></div>

<script type="text/javascript">
  dojo.addOnLoad(function(){
    console.debug(dojo.query("div.foo"));
    dojo.query("div.foo").append("<span>append</span>");
  });
</script>

Error I get from Google Web Toolkit Debugger:

Uncaught TypeError: Object [object HTMLDivElement],[object HTMLDivElement] has no method 'append'
(anonymous function)            myHTML:333
dojo.loaded                     myHTML:333
dojo._callLoaded                dojo.xd.js:14
dojo._xdNotifyLoaded            dojo.xd.js:14
dojo._xdWatchInFlight           dojo.xd.js:14
(anonymous function)            dojo.xd.js:14

Any thoughts as to what might be the problem?


Got the answer from someone on the dojo forums:

dojo.require("dojo.NodeList-manipulate");
0

精彩评论

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

关注公众号