Dynamically changing class name in javascript

We can change the class of an element in javascript using

document.getElementById("element").class = "new Style";

We don’t need to use style.attribute name. We can also change the style using, style property

document.getElementById("element").style.color="red";

No related content found.

This entry was posted in Javascript. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

*


*

You may use these HTML tags and attributes: <a href="" title="" rel=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>