JSFiddle - React, Tailwind, and code Playground

by bgrins

HTML

<div>
Returning <code>#id</code> is not a unique selector when there are elements with duplicate ids
</div>

<div id="one">
    first dup
</div>


<div id="one">
    second dup
</div>

<pre id="log"></pre>

JavaScript

document.querySelector("#log").textContent = [
    "querySelector('#one').textContent: " + document.querySelector('#one').textContent.trim(),
    "document.all['one'].length: " + document.all["one"].length,
    "querySelectorAll('#one').length: " + document.querySelectorAll("#one").length    
    
    
 ].join("\n")