Is there a way to dynamically add a new CSS property to an existing class using JavaScript?
Let's say I have a class called .test
with some pre-defined styling. How can I append the property color: blue;
to this class using JavaScript?
const elm = document.querySelector('.test');
.test {
width: 200px;
height: 50px;
background-color: orange;
}
<div class="test">Testing...123</div>