tags:

views:

46

answers:

2

How would I define css inside () I know this is a simple question but I can't find the answer.

I KNOW this is wrong...

if ('#Box' == .css('display', 'none')) {}

Thanks

+1  A: 

I think you're looking for:

$('#Box').css('display', 'none')

This is actually changing the style of the elements matched by your selector (in this case #Box). It is not the same as defining a new css rule although in simple situations, it has the same effect.

You can read values like this:

var currentDisplayValue = $('#Box').css('display');
if (currentDisplayValue == 'none') {
    // do stuff.
}
Ken Browning
Wow. Why didn't I think of that.
PHPNooblet
A: 

you could also do something like:

$('#Box').hide('fast');

or

$('#Box').slideUp('fast');
Jason