Knowledge baseExam Center
ENEnglish
Choose language13

CKTIS / HTML

HTML concept: progressive-enhancement

Progressive enhancement begins with useful HTML and adds features without making the baseline path depend on script.

Version: WHATWG HTML Living Standard; index snapshot date recorded separately

Syntax

functional HTML baseline → optional script enhancement

Native a, form, button, and details retain meaning and basic operation before JavaScript runs.

noscript applies only when scripting was disabled during parsing; it does not handle a script download or execution failure.

An enhancement can intercept submit with preventDefault(), but should preserve a working action and required validation until initialization succeeds.

The example retains a form with server action and required, then intercepts submit and displays a result without navigation.

Examples

<!doctype html>
<meta charset="utf-8">
<form id="lookup" action="https://example.test/search" method="get">
  <label>Topic <input name="q" value="html" required></label>
  <button>Search</button>
</form>
<output id="result"></output>
<script>
const form = document.querySelector("#lookup");
form.addEventListener("submit", event => {
  event.preventDefault();
  const value = new FormData(form).get("q");
  result.textContent = `action=${new URL(form.action).pathname}; method=${form.method}; valid=${form.checkValidity()}; enhanced=${value.toUpperCase()}`;
}, { once: true });
form.requestSubmit();
</script>

Result

action=/search; method=get; valid=true; enhanced=HTML

The result verifies native validation and the script layer; it does not test disabled JavaScript, a server, or network failure.

Sources