0

Question

How I can make change color of text or background of section div by entry user color ?

14th Jan 2021, 2:03 AM
Nasser
Nasser - avatar
1 Odpowiedź
+ 3
Using Javascript First, you need to get a reference to the element whose color is to be changed. You can use document.querySelector() if there is only one element. https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelector Or use document.querySelectorAll() if there were many elements to work with. https://developer.mozilla.org/en-US/docs/Web/API/Document/querySelectorAll Accept input for the color value in decimal or hexadecimal format, validate the input, and assign the value as fore color or background color of the element(s). https://www.w3schools.com/jsref/prop_style_color.asp https://www.w3schools.com/jsref/prop_style_backgroundcolor.asp
14th Jan 2021, 2:40 AM
Ipang