0

I have an element which dynamically gets a "display:block". Now when this happens I’d like to add a class to another element. I know I have to delegate the code below somehow to the document. But I have no idea how to do this.

if ($(".status").css("display") == "block" ){
  $("#Menu").addClass("reduced");
}
glennsl
  • 28,186
  • 12
  • 57
  • 75
jwssnr
  • 9
  • 3

1 Answers1

-3

It should be as follows:

if ($(".status").attr("display") == "block" ){
   $("#Menu").addClass("reduced");
}

To get any css attribute use .attr()

Kamal
  • 2,550
  • 1
  • 8
  • 13