JSFiddle - React, Tailwind, and code Playground

by Plippie Plop

HTML

<div id="he" class="h">
Hello
</div>
<div id="wo" class="h">
world
</div>

JavaScript

console.log(".h found:",$('.h').length);

if($('.h').length === 1){
console.log(".h is 1");
} else {
console.log(".h is not the only 1")
}

if($('#he').length){
console.log("#he is there");

if($('#he').length === 1){
console.log("#he is the",$('#he').length);
}

} else {
console.log("#heis not there")
}

if($('#a').length ){
console.log("#She is there");
} else {
console.log("#She is not there");
console.log("and is a",$('#a').length);
}