javascript - apply css rules on programmatically created div -


i have site creates new divs in real time (using js). class of each div "conv". problem is, css rules have written class doesn't apply new divs. conv.length length of xml file using.

the js:

for(i=0; i<conv.length;i++){   var div= document.createelement("div");   div.id="conv"+i;   div.class= "conv";   div.innerhtml=conv[i].childnodes[0].nodevalue;   div.style.height="50px";   div.style.overflow="hidden";   document.getelementbyid("conv").appendchild(div); } 

the css:

.conv {   background-color:#ccc; } 

the class property of html element special case, not class attribute. 1 accessible via classname:

div.classname="conv"; 

Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

linux - phpmyadmin, neginx error.log - Check group www-data has read access and open_basedir -