Created
February 3, 2023 00:29
-
-
Save va9iff/ffdf07395498c3b03529b519d359766e to your computer and use it in GitHub Desktop.
el("div.className.another") short function for creating elements with classes
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
export const el = str =>{ | |
const strs = str.split('.') | |
let el = document.createElement(strs.shift()) | |
for (let cls of strs) el.classList.add(cls) | |
return el | |
} | |
el('div.wrapper.hidden') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment