开发者

How to find an element inside another element in mootools

开发者 https://www.devze.com 2022-12-22 04:40 出处:网络
Let\'s say i need to find all .bar elements inside an element that\'s assigned to a variable foo. In jQuery, foo.find(\'.bar\') solves the problem.

Let's say i need to find all .bar elements inside an element that's assigned to a variable foo.

In jQuery, foo.find('.bar') solves the problem.

What's the equivalent function in 开发者_StackOverflow社区mooTools?


<div id="container">
    <span class="elems">...</span>
    <span class="elems">...</span>
    ...
</div>

----

var elems = $('container').getElements('.elems');
// elems is now an array containing all spans with the class 'elem'

Or:

var elems = $$('#container.elems');
0

精彩评论

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