bande
0
Q:

changing css using js in html


<!DOCTYPE html>
<html>
<body>

<h1 id="id1">My Heading 1</h1>


<button type="button" 
onclick="document.getElementById('id1').style.color = 'red'">

Click Me!</button>

</body>
</html> 
0
document.getElementById("myText").className = "anyNewClass"
0

document.getElementById(id).style.property = new style
0

New to Communities?

Join the community