JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<title>Javascript Test Code</title>
</head>
<body>
<div id="myDiv"></div>
</body>
</html>
JavaScript
var App = App || (function () {
var myDiv = $('#myDiv'), // define a global jQuery element variable.
xyz = 'xyz'; // and a bogus variable as a test.
function test()
{
console.log('running test...','myDiv is', myDiv.length); // length is 0
console.log('xyz is ', xyz); // says xyz
console.log('running test...','myDiv is', myDiv.length); //length is 1
console.log('xyz is ', xyz); // still says xyz
}
return {test:test}
}());
$(function(){
App.test();
});