Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Detect label display, remove class hidden

I want to detect if a label's display is none. If it is, then I'll remove the hidden class from the label.

How can this be done in jQuery? I'm new with js & jQuery.

like image 652
user3615014 Avatar asked May 08 '14 06:05

user3615014


3 Answers

You can follow below code

if(!$("label").is(":visible"))
{
  // remove hidden class
  $("label").removeClass("hidden");
}

but if you have multiple labels in your code then try below

$("label").each(function(){
  if($(this).is(":visible"))
     $(this).removeClass("hidden");
});
like image 137
Bhushan Kawadkar Avatar answered Nov 18 '22 17:11

Bhushan Kawadkar


try below code :-

if($("#labelID").is(":visible"))
{
  // remove hidden class
  $("#labelID").removeClass("hidden");
}

Demo :-

http://jsfiddle.net/avmCX/45/

like image 43
Neel Avatar answered Nov 18 '22 18:11

Neel


Try this code:

if(!$("#your_label_id").is(":visible"))
   $("#remove_class").removeClass("class_name");
like image 1
Bla... Avatar answered Nov 18 '22 18:11

Bla...