Pregunta

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.

¿Fue útil?

Solución

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");
});

Otros consejos

try below code :-

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

Demo :-

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

Try this code:

if(!$("#your_label_id").is(":visible"))
   $("#remove_class").removeClass("class_name");

try this:

if($("#lblid").css("display")==='none'){
    $("#lblid").removeClass("hidden");//or $("#lblid").css("display","block")
}

use this code:

if($('label').is(':visible'))
{
  // remove hidden class
 $('.disp-block').removeClass('hidden');
}
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top