How to reset an HTML element to its first/initial value in JavaScript?
I am attempting to reset an element, through JavaScript, to the value that was first specified in the HTML/CSS files, while avoiding "hard-coding" the value. The purpose is making a script that toggles a specific style value between 0 and its "initial" value. For example: A div starts out with 20 pixels of padding (defined by its class or manually through setting the style). When pressing a button, that padding is set to 0. When pressing the button again, the padding would go back to 20 pixels of padding. However, I want this function to be generic, so it should work with other elements that h
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.