<h1>JavaScript getElement(s) examples</h1>

<p class="foo">Select the target you want to highlight by either clicking the button or hovering over it:</p>

<span>click-buttons:</span>

<span>hover-buttons:</span>

<h2>Targeting CSS selectors</h2>

<p>You can target HTML tags using </span>CSS</span> querySelectorAll. This returns an array.</p>

<h2>Targeting tags</h2>

<p>You can target HTML tags using getElementsByTagName. This returns an array.</p>

<h2 class="foo">Targeting classes</h2>

<p class="foo">You can target different HTML tags based on the class they've got using getElementsByClassName. This returns an array.</p>

<h2 class="bar">Targeting IDs</h2>

<p id="special">You can also target a specific ID (remember these are unique) using getElementById. This returns a single item.</p>