Created
May 25, 2019 03:13
-
-
Save gostrafx/3f57ea790c6b3cac511571c029fcd07d to your computer and use it in GitHub Desktop.
selected Elements js
This file contains hidden or 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
| let $ = (classNameOrId)=>{ | |
| let selectedElements = querySelectorAll(classNameOrId); | |
| let elements = (selectedElements.length === 1) ? selectedElements[0] : selectedElements; | |
| return elements; | |
| } | |
| $(".classOr#id").onclick = (event)=>{ | |
| this.innerHTML = `Hello`; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment