bhylu.com

Advertisements

Document Reference

Document is the entry point for page-level DOM operations. It creates elements and exposes information about the current document.

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

<p id="info"></p>
<script>
  document.getElementById("info").textContent = "Document language: " + document.documentElement.lang;
</script>

What happens

The paragraph displays the language on the root HTML element.