Personal I'm starting in javascript and I have many questions related to objects. One of them is this: Let's suppose I create an object.
Here I have a list and I want to store it inside an object and a function of this object is used to change the color of this list.
(It's not exactly what I want to do but to understand)
var Objeto = {
//Aqui eu guardarei meu elemento.
lista : document.getElementsByTagName('li'),
//E esta funcao server para alterar o style das LIs.
alt_cor : function(){
Objeto.lista.setAttribute("style", "color:red");
}
}
Objeto.alt_cor();
<ul class="lista_frutas">
<li>Banana</li>
<li>Laranja</li>
<li>Maça</li>
</ul>