JavaScript – Clear Inline Style of HTML Element
To clear Inline Style of a HTML Element using JavaScript, get reference to the HTML Element element, and assign empty string value to the element.style
property.
Note: This solution clears only the inline style. Any global styles using style sheets shall be applied to the element.
In the following example, we will clear the inline style of HTML Element with id "myElement"
, in JavaScript, using element.style
property.
example.html
ADVERTISEMENT
Conclusion
In this JavaScript Tutorial, we learned how to clear inline style of a HTML Element using JavaScript.