dojo.byId 和 dijit.byId 有什么区别?

发布于 2024-10-02 04:09:00 字数 295 浏览 0 评论 0原文

每次尝试获取页面中元素的值时,都会出现未定义的错误:我已尝试 dijit.byId('myid').innerHTML('loading...');dijit.byId('myid').innerHTML('loading...');

我收到错误 但是当我使用 jquery 执行相同操作时,它可以工作 $('#myid').html('loading ...')

这相当于什么 $('#myid') ').html() 在道场? 感谢您的任何建议

Each time am trying the get the value of an element in my page, I have an error as is undefined: I have tried dijit.byId('myid').innerHTML('loading...');

I get an error
but when i do the same using jquery, it works $­('#myid').html('loading ...')

And what is the equivalent of this $('#myid').html() in dojo?
Thanks for any advise

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

初见 2024-10-09 04:09:00

dijit.byId 通过某个 id 返回一个 dijit 对象。

dojo.byId 相当于$()。要获取/设置它的 HTML,请使用

dojo.byId("my_id").innerHTML
dojo.byId("my_id").innerHTML = some_text`

请注意,dojo.byId 只是 document.getElementById 的包装器,因此您可以使用所有基本功能。

dijit.byId returns a dijit object by some id.

dojo.byId is the equivalent of $(). To get/set it's HTML, use

dojo.byId("my_id").innerHTML
dojo.byId("my_id").innerHTML = some_text`

Note that dojo.byId is just a wrapper around document.getElementById, so you can use all the basic functions.

安静被遗忘 2024-10-09 04:09:00
dijit.byId("my_id") ----> returns the widget associated with the domNode.
dojo.byId("my_id") -----> returns the domNode itself.

使用 dijit 访问 domNode:

dijit.byId("my_id").domNode.innerHTML
dijit.byId("my_id") ----> returns the widget associated with the domNode.
dojo.byId("my_id") -----> returns the domNode itself.

To access the domNode using dijit:

dijit.byId("my_id").domNode.innerHTML
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文