Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Create your own query selector shorthand

const $ = document.querySelector.bind(document);
const $$ = document.querySelectorAll.bind(document);

const mainContent = $('.main-content');
const externalLinks = $$('a[target="_blank"]');
Source by www.30secondsofcode.org #
 
PREVIOUS NEXT
Tagged: #Create #query #selector #shorthand
ADD COMMENT
Topic
Name
4+1 =