<h1>
element over a <span>
element to display a top level heading?Semantic Elements
<article>
<aside>
<details>
<figcaption>
<figure>
<footer>
<header>
<main>
<mark>
<nav>
<section>
<summary>
<time>
<script>
tagUsing addEventListener
const buttons = document.querySelectorAll('button');
for (const button of buttons) {
button.addEventListener('click', createParagraph);
}
Script Loading Strategies
document.addEventListener('DOMContentLoaded', () => {
// …
});
defer
attribute tells the browser to continue downloading the HTML content once the <script>
tag element has been reached<script src="script.js" defer></script>
async
attribute tells the browser to download the script without blocking the page while the script is being fetched
async
when the scripts in the page run independently from each other and depend on no other script on the page