Snippets Collections
export const getElement = (selection) => {
  const element = document.querySelector(selection);
  if (element) {
    return element;
  }
  throw new Error(
    `Please check "${selection}" selector, no such element exists`
  );
}


export const getAllElements = (elements) => {
    const allelements = document.querySelectorAll(elements);
    if(allelements){
      return allelements
    }
    throw new Error(`These ${elements} cannot be found`)
}
star

Wed Mar 22 2023 00:46:04 GMT+0000 (Coordinated Universal Time)

#get #element #function
star

Mon Feb 07 2022 06:44:54 GMT+0000 (Coordinated Universal Time) https://elementtutorials.com/html/html-tutorial.html

#html #tutorials #htmltutorisls #element #elementtutorisls

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension