Skip to content

January 17, 2011

Difference between dojo.byId() and dijit.byId()

Since we’ve completely committed to using the Dojo Toolkit at work, there have been more questions raised about various aspects of the toolkit. One of the more popular ones that I am asked and that I see asked often online is what is the difference between dojo.byId() and dijit.byId()?.

Dojo.byId() is simply a replacement for the native document.getElementById(). Dijit.byId() on the other hand is a utility method that you use to get a reference to an instance of a dijit widget on the page. This means that you won’t be getting a reference to a DOM node like you do with dojo.byId() but rather an instance of a dijit widget class along with access to all of its methods and properties.

Read more from Articles

Share your thoughts, post a comment.

(required)
(required)

Note: HTML is allowed. Your email address will never be published.

Subscribe to comments