HTML DOM API
DOM methods find or create elements. QuerySelector finds the first matching element and returns null if none matches.
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
<p class="notice">Waiting</p>
<script>
const notice = document.querySelector(".notice");
if (notice) notice.textContent = "Booking is open";
</script>
What happens
The selected paragraph receives new text.