Skip to content

Instantly share code, notes, and snippets.

@Nick-Gabe
Created June 23, 2022 23:51
Show Gist options
  • Save Nick-Gabe/4494394353bf8a6b2a8d5803c669694c to your computer and use it in GitHub Desktop.
Save Nick-Gabe/4494394353bf8a6b2a8d5803c669694c to your computer and use it in GitHub Desktop.
Adds styles to a Html Element based on a CSS Object.
HTMLElement.prototype.setStyle = function (newStyles) {
for (let style in newStyles) {
this.style[style] = newStyles[style];
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment