jquery hidden code example

Example 1: element is hidden jquery

// Checks CSS content for display:[none|block], ignores visibility:[true|false]
$(element).is(":visible");

// The same works with hidden
$(element).is(":hidden");

Example 2: hidden jquery

$('#yourid').attr('hidden', false);
$('#yourid').attr('hidden', true);

Example 3: jquery to hide a div

<div id="main"> 
  <p> Hide/show this div </p>
</div>

('#main').hide(); //to hide

// 2nd way, by injecting css using jquery
$("#main").css("display", "none");

Example 4: jquery is element hidden

// Checks css for display:[none|block], ignores visibility:[true|false]
$(element).is(":hidden");

Example 5: data attribute hide & show function syntax in jquery

$('.test').hide().filter('[data-word="AAA"][data-type="BBB"][data-number="2"]').show();