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 have 30px of padding, or 50px, etc.
Is this possible? And if so, how? (ideally, without running a script at page load that makes a backup of all initial values)