Book Image

MooTools 1.2 Beginner's Guide

Book Image

MooTools 1.2 Beginner's Guide

Overview of this book

MooTools is a simple-to-use JavaScript library, ideal for people with basic JavaScript skills who want to elevate their web applications to a superior level. If you're a newcomer to MooTools looking to build dynamic, rich, and user-interactive web site applications this beginner's guide with its easy-to-follow step-by-step instructions is all you need to rapidly get to grips with MooTools.
Table of Contents (14 chapters)
MooTools 1.2 Beginner's Guide
Credits
About the Authors
About the Reviewer
Preface

Working with attribute selectors


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]');

Attribute selector operators

Attribute selectors can match attribute values in various ways using attribute selector operators. The following table depicts a list and description of each attribute selector operator.

Operator

Description

=

Matches attribute value exactly and literally...