If you thought MooTools can't get any cooler with element selection, well, it gets much better. MooTools also implements CSS3's attribute selectors. An attribute selector allows you to select elements based on their CSS attributes, also commonly referred to as "properties" in MooTools.
For example, an<input>
tag's type
is considered one of its attributes (or properties), so is its class
.
<input type="text" name="query" value="" />
In MooTools (as well as CSS3), the syntax for an attribute selector is as follows:
element[attribute=attribute value]
For example, if we wanted to select all<input>
elements with a type of text
, we would write:
$$('input[type=text]');