How do I get a CSS class to work in my Javascript file? -


i want class show var newcaption. below javascript have linked css class.

window.onload = function() {  var caption = document.getelementsbytagname("caption"); var oldcaption = caption[0].innerhtml; var newcaption = oldcaption + "caption";  caption[0].removechild(caption[0].firstchild); caption[0].appendchild(document.createtextnode(newcaption)); 

here's css class:

.hovernode{    background-color:#ffffcc;    border: solid 1px black;    width:100px;    height:100px;    position:relative;    float:top;    font-size:10pt;    margin:5px;    padding:3px;    color:black; } 

add class caption element.

caption.classlist.add('hovernode'); 

Comments

Popular posts from this blog

sublimetext3 - what keyboard shortcut is to comment/uncomment for this script tag in sublime -

java - No use of nillable="0" in SOAP Webservice -

ubuntu - Laravel 5.2 quickstart guide gives Not Found Error -