dojo.byId和dijit.byId有什么区别? [英] What the difference between dojo.byId and dijit.byId?

查看:226
本文介绍了dojo.byId和dijit.byId有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每次尝试获取页面中元素的值时,我都会有一个错误,因为未定义:我尝试过 dijit.byId('myid')。innerHTML('loading .. 。';

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...');

我收到错误
但是当我使用jquery做同样的事情时,它的工作原理是 $('#myid')。html('loading ...')

这个<$ c的等价物是什么dojo中的$ c> $('#myid')。html()?
感谢您的任何建议

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

推荐答案

dijit.byId 返回某个ID的 dijit 对象。

dijit.byId returns a dijit object by some id.

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

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`

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

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

这篇关于dojo.byId和dijit.byId有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆