The multiple attribute selector — written [filter1][filter2][filterN] — matches elements that satisfy every chained attribute filter. Each bracket narrows the set with AND logic. Combine presence, equals, prefix, suffix, and contains operators in one query — available since jQuery 1.0.
01
Syntax
[a][b][c]
02
AND
All must match
03
Mix
= ^ $ *
04
Official
[id][name$='man']
05
Narrow
More specific
06
Since 1.0
CSS + jQuery
Fundamentals
Introduction
Single attribute selectors are powerful on their own — but real pages often need elements that meet several attribute conditions at once. A checkbox named agree, a secure external link, or an email field marked required each needs more than one filter.
Chain attribute selectors back-to-back with no space between brackets: [attributeFilter1][attributeFilter2]. jQuery evaluates every filter and returns only elements that pass all of them. This pattern is standard CSS and has worked in jQuery since version 1.0.
Concept
Understanding Multiple Attribute Selectors
Think of each bracket as a gate. An element must pass through every gate to be selected. If it fails any single filter, it is excluded — even if it matched the others.
name="newsletter", has id → [id][name$="letter"] matches.
name="newsletter", no id → [id][name$="letter"] does not match (missing id).
type="checkbox", name="subscribe" → [type="checkbox"][name="agree"] does not match.
💡
Beginner Tip
Order of brackets does not change AND logic — [id][name$="man"] and [name$="man"][id] select the same elements. Put the filter that eliminates the most candidates first when scoping for readability.
attributeFilter1…N — any valid CSS attribute selector: presence ([name]), exact ([type="text"]), prefix ([href^="https"]), suffix ([name$="pdf"]), contains ([class*="btn"]), etc.
Chaining — no space or comma between brackets; each additional filter applies AND logic.
Return value
A jQuery object containing every element that satisfies all specified attribute filters.
Empty collection when no element passes every filter.
Official jQuery API example
jQuery
$( "input[id][name$='man']" ).val( "only this one" );
// Matches inputs that HAVE an id attribute
// AND whose name value ENDS WITH "man"
// Skips inputs with name ending in "man" but no id
Cheat Sheet
⚡ Quick Reference
Element
[id][name$="man"]
<input id="a" name="superman">
Matches
<input name="superman"> (no id)
No match
<input id="b" name="manual">
No match (name does not end with man)
<input id="c" name="Batman">
No match (case-sensitive suffix)
<input id="d" name="postman">
Matches
<span id="e" name="man">
No match (not an input — add tag if needed)
Compare
📋 Chaining vs .filter(), AND vs OR
Multiple brackets mean AND. Commas and repeated .filter() calls behave differently.
Chained AND
input[id][name$="man"]
All filters in one query
.filter() AND
$("input").filter("[id]").filter("[name$='man']")
Same narrowing, two passes
Comma OR
input[id], input[name$="man"]
Either filter — not both
Mix operators
a[href^="https"][target="_blank"]
Presence + = + ^ + $ + *
Hands-On
Examples Gallery
Example 1 follows the official jQuery API demo. Examples 2–5 cover checkbox fields, secure external links, single vs chained narrowing, and scoped form queries. Use the Try-it links to run each snippet.
📚 Official jQuery Demo
Set the value on inputs that have an id and whose name ends with man.
Example 1 — Official Demo: input[id][name$='man']
Official jQuery demo — find inputs with an id attribute AND name ending with man, then set their value.
jQuery
$( "input[id][name$='man']" ).val( "only this one" );
// Matches: <input id="hero" name="superman">
// Skips: <input name="superman"> (no id)
// Skips: <input id="x" name="manual"> (name does not end with man)
input id="hero" name="superman" → value "only this one"
input name="superman" (no id) → unchanged
input id="x" name="manual" → unchanged
How It Works
Both [id] (presence) and [name$='man'] (suffix) must pass. Removing either bracket widens the match — that is the power of chained AND logic.
Example 2 — Checkbox with Exact Type and Name
Target the terms agreement checkbox using exact type and name filters.
jQuery
$( "input[type='checkbox'][name='agree']" ).prop( "checked", true );
// Matches type="checkbox" AND name="agree"
// Skips text inputs named agree or other checkboxes
https + target="_blank" → class "external-secure"
http + target="_blank" → unchanged
https same-tab link → unchanged
How It Works
Prefix (^=) and exact (=) operators combine in one selector — no need for separate JavaScript checks when CSS attribute rules suffice.
Example 4 — Single Filter vs Chained AND
Compare how adding [id] narrows a suffix-only selector.
jQuery
var single = $( "input[name$='man']" ).length;
var chained = $( "input[id][name$='man']" ).length;
console.log( "name$='man' only:", single );
console.log( "id AND name$='man':", chained );
console.log( "Chained is more specific → fewer matches" );
name$='man' only: 3
id AND name$='man': 1
Adding [id] excludes inputs without an id attribute
How It Works
Each chained bracket is an additional requirement. Use multiple filters when a single operator returns too many elements.
Example 5 — Scoped Required Email Field
Highlight the required email input inside a specific signup form.
jQuery
$( "form#signup input[type='email'][required]" ).addClass( "highlight" );
// Matches email type AND required attribute inside #signup
// Ignores optional email fields or emails in other forms
required email in #signup → class "highlight"
optional email in #signup → unchanged
required email in other forms → unchanged
How It Works
Combine a form ID with chained attribute filters for precise, readable queries — type, presence (required), and container scope in one line.
Applications
🚀 Common Use Cases
Form fields — input[type='checkbox'][name='agree'], input[type='email'][required].
Secure links — a[href^='https'][target='_blank'] for external HTTPS tabs.
File inputs — input[type='file'][accept*='image'] combining type and accept.
Radio groups — input[type='radio'][name='size'][value='large'] with three chained filters.
Data attributes — [data-role='admin'][data-active='true'] for compound state.
Narrow suffix matches — input[id][name$='man'] when suffix alone is too broad.
🧠 How jQuery Evaluates Chained Attribute Selectors
1
Parse chain
Split the selector into element type plus each [filter] bracket.
CSS
2
Test each filter
Every attribute condition must pass — presence, exact, prefix, suffix, or contains.
AND
3
Reject on first fail
One failed filter excludes the element, even if other filters matched.
Strict
4
&
Return collection
Elements passing all filters become a jQuery object for chaining.
Important
📝 Notes
Available since jQuery 1.0 — standard CSS multiple attribute selector.
Chained brackets use AND logic — not OR. Use commas for OR.
Order of brackets does not change which elements match.
Mix any operators: [id], [type="text"], [name$="pdf"], [href^="https"].
More filters mean a smaller, more specific result set.
Pair with element type and container IDs for performance: form#signup input[type='email'][required].
Compatibility
Browser Support
Multiple attribute selectors are part of CSS and work in jQuery 1.0+. Evergreen browsers support chained filters in native querySelectorAll. IE7+ supports attribute selectors with jQuery fallbacks where needed.
✓ CSS · jQuery 1.0+
jQuery [filter1][filter2]
Supported in all modern browsers. Native: document.querySelectorAll("input[id][name$='man']"). Chained AND logic applies everywhere.
100%Standard CSS selector
Google ChromeAll versions · Desktop & Mobile
Full support
Mozilla FirefoxAll versions · Desktop & Mobile
Full support
Apple SafariAll versions · macOS & iOS
Full support
Microsoft EdgeAll versions · Chromium & Legacy
Full support
Internet ExplorerIE 6+ · Legacy environments
Full support
OperaAll modern versions
Full support
[a][b][c]Universal
Bottom line: Ideal when you need elements meeting several attribute conditions. Add brackets to narrow; use commas when you need OR instead.
Wrap Up
Conclusion
The multiple attribute selector chains filters with AND logic — [filter1][filter2][filterN] matches only elements that pass every condition. jQuery’s official demo, $("input[id][name$='man']").val("only this one"), shows how presence and suffix filters combine to target one specific input.
Use chaining when a single attribute operator returns too many elements. Mix =, ^=, $=, *=, and presence selectors freely. Remember that commas mean OR, while chained brackets mean AND — scope queries to forms and containers for clarity.
Mix operators for clarity: a[href^='https'][target='_blank']
Add brackets to narrow overly broad single filters
Prefer one chained selector over multiple .filter() calls when starting fresh
❌ Don’t
Expect OR from chained brackets — use commas instead
Confuse input[a][b] (AND) with input[a], input[b] (OR)
Chain unnecessarily when one filter is already specific enough
Forget that [name] checks presence, not a value
Assume order of brackets changes AND results
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about chained attribute selectors
Every bracket must pass — AND logic all the way.
5
Core concepts
&01
AND chain
All filters
API
[]02
Mix ops
= ^ $ *
Syntax
id03
Narrow
More specific
Pattern
≠ ,04
Not OR
Commas differ
Compare
man05
Official
id + name$ demo
Demo
❓ Frequently Asked Questions
It selects elements that satisfy every chained attribute filter — all conditions must pass. For example, [id][name$="man"] matches only elements that have an id attribute AND whose name value ends with man.
Yes. Writing [filter1][filter2][filter3] means the element must match filter1 AND filter2 AND filter3. There is no OR between chained brackets — use .filter() with multiple selectors or a comma-separated list for OR.
Yes. You can combine presence ([id]), exact match ([type="text"]), prefix ([href^="https"]), suffix ([name$="pdf"]), and contains ([class*="btn"]) in one selector string.
Yes. Multiple attribute selectors are standard CSS and have worked in jQuery since 1.0, with native querySelectorAll support in modern browsers.
Chaining in the selector string ([a][b]) evaluates all filters during the initial query — often faster and clearer. $( "input" ).filter( "[name$=man]" ).filter( "[id]" ) achieves similar AND narrowing on an existing collection but runs as separate passes.
Each bracket narrows the result set. A single [name$="man"] may match many inputs; adding [id] restricts to elements that also have an id — more specific, fewer false positives.
Did you know?
Chaining attribute selectors in jQuery works exactly the same way as in CSS stylesheets. Rules like input[type="checkbox"][disabled] { opacity: 0.5; } use the same AND logic — every bracket must match before the style applies.