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
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
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.
}
you could also do something like:
$('#Box').hide('fast');
or
$('#Box').slideUp('fast');