Created
December 13, 2011 17:26
-
-
Save brianblakely/1473024 to your computer and use it in GitHub Desktop.
Feeding DOM Elements Directly to jQuery
This file contains 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
// Element By ID | |
var $foo = $(document.getElementById('foo')); | |
// Multiple Elements By ID | |
var $$foobar = $([ | |
document.getElementById('foo'), | |
document.getElementById('bar') | |
]); | |
// Node List | |
var $$allTheSpans = $(document.getElementById('foo').getElementsByTagName('span')); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment