Querying the DOM - Element Styles
let button = document.getElementById("hello");
button.style;let element = document.querySelector(query);
element.style.color; // returns the color of the element
element.style.border; // returns the border specification of the element
element.style.backgroundColor; // returns the background colorOne small problem
button.style.backgroundColor = "red"; // or any other color value you like<button id="hello" onclick="alert('Hello!')" style="background-color: red;">...</button>
Next steps
Last updated