Created
September 5, 2023 06:45
-
-
Save AlbinSoft/893a7af1832ba1816c06ee8e5a963ec7 to your computer and use it in GitHub Desktop.
JQuery css method equivalent with Vanilla JS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
HTMLElement.prototype.css = function (props) { | |
for(prop in props) this.style.setProperty(prop, props[prop]); | |
return this; | |
}; | |
/* | |
* Online demo: https://codepen.io/albinsoft/pen/OJrRKvm | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment