Created
February 27, 2013 09:09
-
-
Save bitboxx/5046500 to your computer and use it in GitHub Desktop.
Javascript: basic selector (class and id)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* remember putting / caching element in variable is faster */ | |
/* select id with pure javascript, element by id is faster */ | |
var bar = document.getElementById("bar"); | |
var $el = document.querySelector('#hello'); | |
/* select tag with pure javascript */ | |
var $el = document.querySelector('.bye'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment