Mootools css multiple attributes

I am trying to map several CSS attributes in Mootools [version 1.11], as in this element:

<input type="radio" value="dev" name="radio_server">

I would like to map this element which has type = 'radio' and value = 'dev' attributes. Tried this, but it does not work.

$$('input[type=radio][value=dev]')

also does not work

$$('input[type=radio,value=dev]')
$$('input[type=radio && value=dev]')

on this page: http://api.jquery.com/multiple-attribute-selector/ has a jQuery solution, is there something like Mootools?

+3
source share
1 answer

as mentioned in Dimitar, in mootools 1.11 you can link a function filterto filter your array, here is an example: http://jsfiddle.net/HHQNE/

here's what it is:

function radioAndDevPredicate(elt) {
     return elt.getProperty("type") == "radio" && elt.getProperty("value") == "dev";
}

document
    .getElements("input")
    .filter(radioAndDevPredicate)
    .each(function (foo) {
        foo.addClass("active");
    });
+1
source

All Articles