Skip to content Skip to sidebar Skip to footer

Clear All Javascript-applied Styles

Let's say we have this var e = document.getElementById('someElement'); e.style.borderColor = 'gold'; e.style.background = 'yellow'; e.style.padding = '5px'; // more style modificat

Solution 1:

As an option you could store initial style attribute (e._originalStyle = e.style.cssText) in a private property and restore it when you'll need to drop all styles applied via javascript (e.style.cssText = e._originalStyle)


Post a Comment for "Clear All Javascript-applied Styles"