'Search for inline style in entire document and replace color
I have a document with many inline styles. I would like to search for color: #019e93; and replace the color with #80D5CF. How can I do that?
Solution 1:[1]
Use the Attribute selector []
document.querySelectorAll("[style*='#019e93']").forEach(el => {
el.style.color = "red"; // Or use "#80D5CF"
})
<div style="font-size:1rem; color: #019e93;">TEST</div>
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Roko C. Buljan |
