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
Post a Comment