views:

39

answers:

2

Hi Guys,

I am trying to use jQuery to establish whether a CSS property has changed inside a class. I dont want to use .HasClass() - I want to find a property within the CSS - namely

display:block;

I thought maybe this might work ?

if (jQuery('css-class').css('display') == 'block')

But not sure if it does. Does anyone have any suggestions ?

Thx

A: 

jQuery's .css('css-property') function will return the value of the property, if it exists. So, the check for display:block

if($('selector').css('display') == 'block')

does work.

Dimskiy
A: 

From what I understand, you should replace css-class with a selector:

if (jQuery('#some_id').css('display') == 'block')
{
  // your code...
}

The code within if block will execute if the element with id #some_id has display set to block.

Sarfraz