How to work with style in javascript

For those of us who have been working with web pages for some time, we are always faced with the problem that in some cases we need the user to change certain elements on the site, such as colors, inputs and even images. So, with the help of javascript we can now allow our users to make these changes. See some examples below: ```js let myDiv = document.getElementById("myDiv"); // set the background color myDiv.style.backgroundColor = "red"; // change the dimensions myDiv.style.with = "100px"; myDiv.style.height = "200px"; // assign a border myDiv.style.border = "1px solid black"; ``` you can apply the event property to a button so that as soon as the user clicks, the changes are all applied.Heres another example ```js let prop, value, i, len; for(i =0, len= myDiv.style.length; i < len; i++) { prop = myDiv.style[i]; // alterbately, myDiv.style.item(i) value = myDiv.style.getPropertyValue(prop) console.log("prop: ${value}"); } ``` for more examples like this visit our chat and there well talk more about javascript ­čĹë [javascript chatroom](https://chat-to.dev/chat?q=javascript-room)

All comments