O'Reilly logo

Instant JQuery Selectors by Aurelio De Rosa

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

The All selector (Must know)

With our template in place, we can start diving into the world of jQuery selectors. A selector is a string that allows you to retrieve DOM's elements. The first selector we'll look at is the All (or Universal) selector. We'll use it to apply a border to all of the page's elements.

How to do it...

To achieve our goal, perform the following steps:

  1. Create a copy of the template.html file and rename it the-all-selector.html.
  2. Inside the <body> tag, add the following HTML markup:
    <h1>The all selector</h1> <div> This example shows how to use the All selector. <p>As you can see, it doesn't matter we're different tags, we all have the border applied.</p> <span>Every tag has the border, even the body, the html and the head tag!</span> ...

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