bhylu.com

Advertisements

HTML First Features

HTML already provides controls for many common interactions. Use the browser built-in semantics before adding custom behaviour.

Where to run this

This example changes a document. Open it in the HTML playground, then select Run code. It runs inside a separate preview.

A practical example

HTML + JavaScript

<label for="quantity">Places</label>
<input id="quantity" type="number" min="1" max="6" value="1">
<details>
  <summary>Booking rules</summary>
  <p>Reserve between one and six places.</p>
</details>

What happens

Native fields and disclosure markup express the intended interaction.