// What element(s) will this selection fetch?
//
// Write in, in plain english, what element(s) will match
//
// For example:
//
// $("p");
// // All paragraphs
//
// We'll go through them together to check our answers
$("h1");
//all h1 tags
$("#container");
//all tags with id=container
$(":input");
//all form inputs
$(".basic :input");
// all form inputs withing tags with class=basic
$("div:last");
// just the last div tag
$(".footer");
//all tags with type=footer
$("td:nth-child(3)");
//the third td tags
$("tr:odd td");
//all odd numbered td tags within a tr tag
$("#user-registration h2");
//all h2 tags within any tag with id=user-registration
$("input[name='email']");
//all input tags with name=email
$("select option[value='blue']");
//all option tags that have value=blue within any select tags
// gear shift
$("input", "fieldset");
//all input tags inside all fieldset tags
$("p", ".footer");
//all p tags inside tags that have class=footer
var form = $("form");
form.find("fieldset");
//finds all fieldset tags within all form tag
var inputs = $("input");
inputs.filter("[type='text']");
//selecting all tags inside all input tags EXCEPT those with type=text
//filter removes those with that attribute
$("fieldset.basic").filter("h2");
//selects all tags in fieldset tags with class=basic EXCEPT the h2 tag
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.