O'Reilly logo

MooTools 1.3 Cookbook by Jay Larry G. Johnston

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Removing a group of elements using CSS selectors

Have an offending group of HTML elements? This task will obliterate them in one fell swoop.

Getting ready

CSS Selectors are used in styling to grab specific elements. This makes them a great way to also identify and group elements of our HTML DOM. Remember, grab single elements by their ID attributes; those are always unique on a page.

How to do it...

Grab groups of elements by CSS selector, most frequently by class. In our example, we use both class and tag CSS syntax to group together elements that we will remove.

<script type="text/javascript" src="mootools-1.3.0.js"></script> </head> <body> <p class="remove"><span>The </span> Fox jumped over the lazy dog.</p> <p class="remove">Jack and Jill went ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required