Skip to Content | Skip to Navigation


dijit.getEnclosingWidget

API Info

full API:http://dojotoolkit.org/api/dijit/getEnclosingWidget
summary:Returns the widget whose DOM tree contains the specified DOMNode, or null if the node is not contained within the DOM tree of any widget

Parameters

Signature

dijit.getEnclosingWidget( /* DOMNode */ node)

Overview

  • node DOMNode

Example

Obtain a widget reference by determining the immediate-most parent widget from some passed Node. It will walk up the DOM tree testing for a widget using dijit.byNode until an appropriate widget is found:

dojo.query("#bar").onclick(function(e){
     var aWidget = dijit.getEnclosingWidget(e.target); // pass a domNode
     if(aWidget){
         // found something!
         aWidget.set("value", "clicked!!!");
     }
});