mootools php faith camera linux

mootools

Selectors in
MooTools and JQuery



There are two methods of getting DOM elements (1) by id and (2) by css selector.

JQuery grabs everything by css selector:


$('#my_id')   // grabs a single element
$('.all_of_this_class')  // grabs a collection

MooTools does it too, but it's easier to read:

$('my_id')   // grabs a single element (by id)
$$('.all_of_this_class'// grabs a collection

One other note is that in MooTools...

$$('#my_id'// works, and grabs one element
             // but still returns a group
             // so therefore
$$('#my_id')[0]
             
// is the same as
$('my_id'


Read a MooTools book review about a book that further demonstrates MooTools DOM selection techniques.

Last Updated: 2011-10-29 14:56:22
Creative Commons License Jay Johnston is a Zend Certified Engineer in PHP 5 LPI-ID: LPI000102450, Verfication Code: wmnnt56y2k  ... Jay Johnston is certified as LPIC-1 by the Linux Professional Institute