开发者

Can we use OR operator in MooTools/Jquery selectors

开发者 https://www.devze.com 2023-03-25 13:50 出处:网络
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 selec

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

精彩评论

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

关注公众号