Jump to content

[Resolvido] Array de divs


coxosclassic
 Share

Recommended Posts

Boas a todos,

Preciso criar um array com os filhos de um elemento (div) e tenho o seguinte codigo:

<div id="container">
 <div class="a"></div>
 <div class="b"></div>
 <div class="c"></div>
</div>

var children = [];
children = $('#container').children();

de seguida preciso de definir a opacity de cada um deles:

...
children[i].css('opacity', 0); //ERRO
...

Mas da erro: Uncaught TypeError: Object #<HTMLDivElement> has no method 'css'

Percebi que o array nao contem elementos div, e gostaria de saber como carregar os elementos div para o array.

Sera este o melhor metodo para se conseguir isto?

Existe(m) outro(s) melhor(es)?

cumps,

cc

Edited by coxosclassic

Cumps,

cc

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.