Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
September 23, 2021 09:25 am GMT

How to add a class to the element?

Theres some site.
Theres an element on that site.
Theres a class named orange.
We need to set the className property of the object.
Thats all.

const element = document.getElementById('element');element.className = 'orange';
.orange {    color: orange;}

We have got an element with added class.

I hope you found this article useful, if you need any help please let me know in the comment section.

See you next time. Have a nice day!

Subscribe to our channel:
https://www.youtube.com/c/Samovar101


Original Link: https://dev.to/101samovar/how-to-add-a-class-to-the-element-896

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To