The Basics
The $ function is the basic selector within Mootools.
With it, you can select a DOM element by
ID.
//selects the element with the ID body_wrap
$( body_wrap );
<div id="body_wrap">
</div>
.
getElement
.
getElement(); extends $, allowing you to...
More
The Basics
The $ function is the basic selector within Mootools.
With it, you can select a DOM element by
ID.
//selects the element with the ID body_wrap
$( body_wrap );
<div id="body_wrap">
</div>
.
getElement
.
getElement(); extends $, allowing you to refine your selection.
For example, you could select the
ID body wrap with $, then select the first child anchor.
.
getElement(); only selects a single element
and will return the first if there are multiple options.
If you add a class name within .
getElement();,
you will get the first occurrence of an element with that class name, not an array of all elements.
To select multiple elements, see getElements(); below.
//selects the first child anchor within the element with the ID body_wrap
$( body_wrap ).
getElement( a );
//selects the element with the ID special_anchor within the element
body_wrap
$( body_wrap ).
getElement( #special_anchor );
//selects the first child with the class special_anchor_class within the
elem
Less