开发者

Can we use OR operator in MooTools/Jquery selectors

Can we use relational operator in mootools selectors ? Say for example I have two check boxes with different names.How can I get them both 开发者_如何学编程in single selector query.


for mootools selector engine Slick, it's just the same as in jquery:

document.getElements("div.foo, div.bar, div.bar a");

or also known as $$.

$$("div.foo,div.bar"); // vs $("div.foo,div.bar"); in jquery

both frameworks try to adhere to CSS 3 selectors and expand them with edge cases like reverse combinators etc

Notice $ in mootools is an alias for document.id, which you can think of like a document.getElementById, not at all like the jquery function wrapper, it returns a single element. if you want to pick an element by id it's document.id("someid") and not $("#someid") or the much favoured mistake by jquery users coming into mootools of $$("#someid"). You can, though, use $$("#someid,#anotherid") to get a collection of elements by their ids.


In JQuery you can input multiple selectors, divided by comma:

http://api.jquery.com/multiple-selector/

$("div,span,p.myClass").whatever ...
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜