What do you want to save?
Add Code snippet
New code examples
-
Javascript 2022-01-23 01:42:00
javascript style
var elem = document.querySelector('#some-element'); // Set color to purple elem.style.color = 'purple'; // Set the background color to a light gray elem.style.backgroundColor = '#e5e5e5'; // Set the height to 150px elem.style.height = '150px'; Add solution -
Javascript 2022-01-22 19:41:14
addeventlistener js to change style
var button = document.querySelector("button"); button.addEventListener("click", function() { const curColour = document.body.style.backgroundColor; document.body.style.backgroundColor = curColour === 'red' ? 'blue' : 'red'; }); Add solution -
Javascript 2021-11-19 12:58:28
javascript style background color
// change background color for specific id .. function changebackground(){ document.getElementById('id').style.backgroundColor = 'green' ; } // change background color for whole body.. function changebackground(){ document.body.style.backgroundColor =... Add solution -
Javascript 2021-11-14 13:47:19
document style
var elem = document.querySelector('#some-element'); // Set color to purple elem.style.color = 'purple'; // Set the background color to a light gray elem.style.backgroundColor = '#e5e5e5'; // Set the height to 150px elem.style.height = '150px'; Add solution -
Javascript 2021-11-06 03:53:13
change color of css in js
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Change the Background Color with JavaScript</title> <script> // Function to change webpage background color functio... Add solution
Best helpers
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5
+5