Check if jQuery is hidden true or false
I have this
$('#div').attr("hidden", true);
I tried:
var a = $('#div').attr("hidden");
var b = $('#div').attr("hidden").val();
var c = $('#div').hidden;
var a = $('#div').disabled;
I just want to know if the hidden is true or false. somebody knows? my research results relate to shapes and materials.
+3
source to share
3 answers
the attribute will never be true
, it can only have strings.
jQuery has functions data
for objects other than strings:
$('#div').data("hidden", true); // set the "hidden" data
var flag = $('#div').data("hidden"); // get the "hidden" data (true)
If you want to hide div
, use .hide()
:
$('#div').hide();
And you check if the div is displayed with :visible
\:hidden
$('#div').is(':visible'); // Or $('#div').is(':hidden')
+9
source to share