-4

I know how to change the class of div using JavaScript classList.add and classList.add. But my purpose is change data inside the class using JavaScript.

as example,

let think I have class called example,

.example {
position:bsolute;
width:100;
}

Is it possible change the width of example class using JavaScript. If yes, how can I change it?

Pure JavaScript only. cant use any libraries.

Vikum Dheemantha
  • 764
  • 8
  • 24

1 Answers1

-2

Here is a javascript solution:

var example = document.getElementByClassName("example");
example.style.width = "50px";
smacaz
  • 148
  • 8