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> ...

Get Instant JQuery Selectors now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.