I am trying to match in Mootools [version 1.11] a multiple CSS attribute as in this element:
<input type="radio" value开发者_开发技巧="dev" name="radio_server">
I would like to match this element that has both type='radio' and value='dev' attribs. Tried this but this is not working
$$('input[type=radio][value=dev]')
also not working
$$('input[type=radio,value=dev]')
$$('input[type=radio && value=dev]')
this page: http://api.jquery.com/multiple-attribute-selector/ has a JQuery solution is there anything like also for Mootools ?
as mentioned by Dimitar, in mootools 1.11, you could chain a filter
function to filter your array, here is an example :
http://jsfiddle.net/HHQNE/
here is what's in there :
function radioAndDevPredicate(elt) {
return elt.getProperty("type") == "radio" && elt.getProperty("value") == "dev";
}
document
.getElements("input")
.filter(radioAndDevPredicate)
.each(function (foo) {
foo.addClass("active");
});
精彩评论