views:

46

answers:

2

I have some HTML that looks like this,

<div id="mb_contents" style="visibility: visible; opacity: 1; width: 600px; height: 450px;">

I am trying to turn the visibilty to hidden using this js/mootools,

$('mb_overlay').set('styles', {
            'visibilty': 'hidden',
        });

However nothing seems to be working, am I missing something?

+1  A: 

There's a method called setStyle. In your case you'd use it like this:

$('mb_overlay').setStyle('visibility', 'hidden');

I think what you are actually doing with your code is setting an attribute called styles, which doesn't really exist.

mqchen
many thanks is there a way to add a 2 second delay before this method gets fired?
sea_1987
Yes, I think `$('mb_overlay').setStyle('visibilty', 'hidden').delay(2000);` would do it.
mqchen
mq.chen, you're wrong. `el.set('styles', {});` is the correct way of adding styles.
Oskar Krawczyk
+3  A: 

You've misspelled "visibility"

This works just fine:

$('mb_contents').set('styles', {
    'visibility': 'hidden'
});
Oskar Krawczyk