开发者

Mootools - selecting a DOM element by its classes

I use MooTools, and I need to find the element which has both classes "a" and "b" (the innermost div in my example below).

The HTML structure is:

<div class="a">
   <div class="otherclass"&g开发者_JS百科t;
      <div class="b"></div>
   </div>
 </div>

In jQuery it's $("div .a .b"), as far as I know. What's the mootools syntax? I've tried

$$("div .a .b")

but it doesn't return any results.

Thanks!

-- To clear things, I want to get ONLY the divs which have both classes (in this case, only one.) thanks.


var divsB = $$("div.a div.b");

http://mootools.net/shell/jfnWK/ - selects the first one but not the second as it's not a child of a div.a


What about

$$('div.a div.b')

or

$$("div.a").getElements("div.b");
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜