JSFiddle - React, Tailwind, and code Playground
by natarajgandhi
HTML
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<input type="hidden" id="test-var" name="country" value="Norway">
<a id="link-test" href="abcd.com" data-structure="doctree">hi</a>
JavaScript
var a = undefined;
var hdn = $('#test-var').val();
alert(hdn);
if(typeof hdn == 'undefined')
{
alert('yes hdn is undefined');
}
if(typeof hdn != 'undefined')
{
alert('no hdn is not undefined');
}
var lnk = $('#link-test').attr('data-structure');
if(typeof lnk == 'undefined')
{
alert('yes lnk is undefined');
}
if(typeof lnk != 'undefined')
{
alert('no lnk is not undefined');
}
alert('pass');