Skip to content

Instantly share code, notes, and snippets.

@AlbinSoft
Created September 5, 2023 06:45
Show Gist options
  • Save AlbinSoft/893a7af1832ba1816c06ee8e5a963ec7 to your computer and use it in GitHub Desktop.
Save AlbinSoft/893a7af1832ba1816c06ee8e5a963ec7 to your computer and use it in GitHub Desktop.
JQuery css method equivalent with Vanilla JS
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