Skip to content

Instantly share code, notes, and snippets.

@Linda-chan

Linda-chan/JuqeryReplacement.js Secret

Created May 16, 2021
Embed
What would you like to do?
//===================================================================
function getById(id) {
if ("querySelector" in document) {
return document.querySelector("#" + id);
} else {
return document.getElementById(id);
}
}
//===================================================================
function getByTagName(tagName) {
if ("querySelectorAll" in document) {
return document.querySelectorAll(tagName);
} else {
return document.getElementsByTagName(tagName);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment