The attribute equals selector — written [name="value"] — matches elements whose attribute value is exactly equal to your search string. Matching is case-sensitive. It is the foundation of attribute selectors — ideal for type, name, and fixed option values — available since jQuery 1.0.
01
Syntax
[attr="x"]
02
Exact
Full value
03
Case
Sensitive
04
Official
value='Hot Fuzz'
05
vs *=
Whole not part
06
Since 1.0
CSS + jQuery
Fundamentals
Introduction
Before prefix, suffix, or substring operators, there is the simplest attribute rule: exact equality. When you know the full attribute value — a button type, a field name, a country code in an option — the equals selector is the clearest choice.
The syntax [attribute="value"] checks whether the attribute string equals your search text with no extra characters before or after. jQuery has supported this selector since version 1.0, and browsers implement it natively through standard CSS attribute selectors.
Concept
Understanding the Equals Selector
Think of the attribute value as a label on a box. The selector asks: “Is this label exactly my text — nothing more, nothing less?” If yes, the element matches.
value="Hot Fuzz" + [value="Hot Fuzz"] → matches.
value="Hot Fuzz 2" + [value="Hot Fuzz"] → no match (extra characters).
type="submit" + [type="submit"] → matches.
type="button" + [type="submit"] → no match.
💡
Beginner Tip
If the value might appear as part of a longer string, use [attr*="value"] instead. Equals is strict — use it when you know the complete attribute value.
attribute — the HTML attribute name (name, value, type, etc.).
value — exact string the attribute value must equal (case-sensitive). Can be a valid identifier or a quoted string.
Return value
A jQuery object containing every element whose attribute equals the value.
Empty collection when no values match.
Official jQuery API example
jQuery
$( "input[value='Hot Fuzz']" ).next().text( "Hot Fuzz" );
// Matches only value="Hot Fuzz"
// Does NOT match value="Hot Fuzz 2" or value="hot fuzz"
Cheat Sheet
⚡ Quick Reference
value attribute
[value="Hot Fuzz"]
Hot Fuzz
Matches
Hot Fuzz 2
No match
hot fuzz
No match (case differs)
Hot Fuzz!
No match (extra character)
Hot
No match (partial value)
Cold Fuzz
No match (leading space)
Compare
📋 [attr="x"] vs [attr*="x"] and other operators
Equals checks the whole value; other operators check position or tokens.
Exact =
[type="submit"]
Full value only
Contains *
[href*="pdf"]
Substring anywhere
Starts ^
[href^="https"]
Prefix at start
Ends $
[href$=".pdf"]
Suffix at end
Hands-On
Examples Gallery
Example 1 follows the official jQuery API demo. Examples 2–5 cover exact-match rules, operator comparison, submit buttons, and scoped form fields. Use the Try-it links to run each snippet.
📚 Official jQuery Demo
Update the next sibling span for inputs whose value is exactly Hot Fuzz.
Example 1 — Official Demo: input[value='Hot Fuzz']
Official jQuery demo — find inputs with value exactly Hot Fuzz and set the text of the next sibling span.
input value="Hot Fuzz" → next span text "Hot Fuzz"
Other inputs → span unchanged
How It Works
jQuery compares the entire value string to Hot Fuzz. Even one extra character or different casing breaks the match — that is what makes equals precise.
Example 2 — Test Exact Matching with .is()
Programmatically verify which value strings equal Hot Fuzz.
Submit inputs → disabled
Button and reset inputs → unchanged
How It Works
HTML input types are fixed tokens — perfect for exact matching. This pattern is clearer than filtering by tag alone when mixed button types share the page.
Example 5 — Scoped Field #login-form input[name='username']
Highlight the username field inside one form by exact name match.
jQuery
$( "#login-form input[name='username']" ).addClass( "highlight" );
// Matches name="username" inside #login-form
// Ignores username_confirm or fields in other forms
Field names — input[name='email'], textarea[name='message'].
Option values — option[value='us'] for country dropdowns.
Data attributes — [data-role='admin'] when the value is a fixed token.
Link targets — a[target='_blank'] for external links.
Radio groups — input[type='radio'][name='size'][value='large'].
🧠 How jQuery Evaluates [attr="value"]
1
Read attribute
Get the full string value from each candidate element.
DOM
2
Compare exactly
Check whether the value equals the search string — case-sensitive, full length.
Exact
3
No partial match
Extra characters before or after the string fail the match.
Strict
4
=
Return collection
Matching elements become a jQuery object for chaining.
Important
📝 Notes
Available since jQuery 1.0 — standard CSS attribute selector.
Comparison is case-sensitive (per official jQuery docs).
The entire attribute value must match — whitespace counts.
Not the same as *= — substring anywhere vs full value only.
Quote values with spaces: [value='Hot Fuzz'].
Pair with element type and ID for performance: #form input[name='email'].
Compatibility
Browser Support
The attribute equals selector is part of CSS and works in jQuery 1.0+. Evergreen browsers support it in native querySelectorAll. IE7+ supports attribute selectors with jQuery fallbacks where needed.
✓ CSS · jQuery 1.0+
jQuery [attribute="value"]
Supported in all modern browsers. Native: document.querySelectorAll("input[type='submit']"). Case-sensitive matching 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
[attr="value"]Universal
Bottom line: Ideal for fixed tokens like input types and field names. Use *= when the value may be part of a longer string.
Wrap Up
Conclusion
The attribute equals selector [name="value"] matches when an attribute value is exactly your search string — case-sensitive and complete. jQuery’s official demo, $("input[value='Hot Fuzz']").next().text("Hot Fuzz"), shows how precise matching works on form values.
Use = for known full values like type="submit"; use *=, ^=, or $= when you need substring or positional matching instead. Scope selectors to keep queries fast and readable on large pages.
Forget leading or trailing spaces in attribute values
Assume hot fuzz matches ="Hot Fuzz"
Omit quotes around values that contain spaces or special characters
Summary
Key Takeaways
Knowledge Unlocked
Five things to remember about [attr="value"]
Exact match of the full attribute value.
5
Core concepts
=01
= syntax
Exact value
API
Aa02
Case
Sensitive
Rule
type03
Submit
Common use
Pattern
≠ *04
Not *=
Full string
Compare
Hot05
Official
Hot Fuzz demo
Demo
❓ Frequently Asked Questions
It selects elements whose named attribute value is exactly equal to the given string — character for character. For example, [value="Hot Fuzz"] matches only value="Hot Fuzz", not value="Hot Fuzz 2" or value="hot fuzz".
Yes. jQuery and CSS attribute selectors use case-sensitive comparison for attribute values in HTML documents. value="hot fuzz" does not match [value="Hot Fuzz"] because the casing differs.
[attr="pdf"] matches only when the entire value is exactly pdf. [attr*="pdf"] matches pdf anywhere inside the value. [attr^="pdf"] matches values starting with pdf. [attr$="pdf"] matches values ending with pdf.
Yes. The attribute equals selector is standard CSS and has worked in jQuery since 1.0, with native querySelectorAll support in modern browsers.
Yes. input[type="submit"] is one of the most common exact-match patterns — it targets inputs whose type attribute is exactly submit.
No. The entire attribute value must match exactly. Use [value*="Hot Fuzz"] if you need substring matching anywhere in the value.
Did you know?
CSS attribute selectors form a family: = exact, ~= word, |= prefix, ^= starts-with, $= ends-with, and *= contains. The equals operator is the strictest — use it when you know the complete attribute value.