diffsnack
HTML Guess the result Level 5

HTML exercise: Popovers without JavaScript — This page has no JavaScript. What happens when you tap "Tuning tip"?

The exercise

This page has no JavaScript. What happens when you tap "Tuning tip"?

1<button type="button"
2 popovertarget="tuning-tip">
3 Tuning tip
4</button>
5<div id="tuning-tip" popover>
6 <p>Tune up to the note, not down.</p>
7</div>
  1. The hidden tip box opens on top of the page
  2. Nothing, because there is no JavaScript
  3. The page jumps to a new URL
  4. The tip box is deleted from the page

Solution

Answer: The hidden tip box opens on top of the page

An element with popover starts hidden, and a button with popovertarget opens or closes it without JavaScript. Because popovertarget="tuning-tip" matches the id, tapping the button shows the tip on top of the page.

Play this exercise Learn the concept: Popovers without JavaScript