Skip to content

Instantly share code, notes, and snippets.

@gostrafx
Created May 25, 2019 03:13
Show Gist options
  • Save gostrafx/3f57ea790c6b3cac511571c029fcd07d to your computer and use it in GitHub Desktop.
Save gostrafx/3f57ea790c6b3cac511571c029fcd07d to your computer and use it in GitHub Desktop.
selected Elements js
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