daily pastebin goal
3%
SHARE
TWEET

Untitled

a guest Nov 22nd, 2017 50 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const $$ = ( selector, context = document ) => {
  2.   const regex = /^#/g
  3.   const elements = context.querySelectorAll( selector )
  4.  
  5.   return ( regex.test( selector ) )
  6.             ? elements[ 0 ]
  7.             : elements
  8. }
  9.  
  10. $$( '#myjQuery' ).innerHTML = $$( 'div' ).length
  11. $( '#jQuery' )[ 0 ].innerHTML = $( 'div' ).length
RAW Paste Data
Top