开发者

What is the Dojo equivalent of jQuery's scope attribute?

开发者 https://www.devze.com 2022-12-23 23:17 出处:网络
In jQuery, a DOM node or jQuery object can be passed as an attribute in a query, w开发者_JS百科hich sets the scope:

In jQuery, a DOM node or jQuery object can be passed as an attribute in a query, w开发者_JS百科hich sets the scope:

var myScope = $('#someDiv');
$('a',myScope).addClass('red');
$('li',myScope).css('display','inline');

Now, in Dojo I can chain several .query()s after each other, but what should I do if I have a certain DOM node - not a nodeList - that I want to use as a scope?

KTHNX


It's just like jQuery. The query() method has an additional parameter which can be used as scope:

dojo.query("#someDiv", scope)

Where scope can be an element ID or a DOM node.

For further information have a look at the Dojo API documentation.

0

精彩评论

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