JSFiddle - React, Tailwind, and code Playground

HTML

<html>
<body>
    <p id="test"></p>
</body>
</html>

JavaScript

var element = "test"; if you try to comment this line or change value , it will give error 
if(!$('#'+element).length){
   alert("do something");
    
} else {
   alert("Tab or portlet already exists...");
}