Skip to content

Instantly share code, notes, and snippets.

@brianblakely
Created December 13, 2011 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brianblakely/1473024 to your computer and use it in GitHub Desktop.
Save brianblakely/1473024 to your computer and use it in GitHub Desktop.
Feeding DOM Elements Directly to jQuery
// 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