Last active
October 10, 2016 03:30
-
-
Save goodbedford/f397eb252a74c4bb140628fde41954d7 to your computer and use it in GitHub Desktop.
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
// vanilla javascript | |
var someId = document.getElementById("name-of-div"); // returns one element by id | |
var someId2 = document.querySelector("#name-of-div"); // returns one element using CSS selector syntax | |
// Jquery | |
var someId2 = $("#name-of-div"); // returns one element with new jquery methods using CSS selector syntax | |
// vanilla javascript | |
var someClass = document.getElementsByTagClassName("name-of-class"); // returns an array-like list of elements | |
//Jquery | |
var someClasses = document.querySelectorAll(".name-of-class"); // returns an array-like list of elements | |
var someClasses = $(".name-of-class"); // returns an array-like list of elements with new jquery methods |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment