TutorialKart
index.html
►
Run
Reset
<!DOCTYPE html> <html lang="en"> <body> <h1>Change Accent Color with JavaScript</h1> <h3>Checkbox Example:</h3> <input type="checkbox" id="checkbox1" checked> <label for="checkbox1">Checkbox 1</label><br> <button id="changeColorBtn">Change Accent Color</button> <script> // Function to change accent colors dynamically document.getElementById("changeColorBtn").addEventListener("click", function () { const checkboxes = document.querySelectorAll("input[type='checkbox']"); // Set accent color for checkboxes checkboxes.forEach(checkbox => { checkbox.style.accentColor = "red"; }); }); </script> </body> </html>