The attribute not-equal selector matches elements that do not have the attribute, or have it with a value other than the given string. Available since jQuery 1.0 (jQuery extension). Equivalent to :not([attr='value']).
Remember
$("[attribute!='value']")
$("input[name!='newsletter']")
✓ no name attribute
✓ name="accept"
✗ name="newsletter"
!= ≈ :not([attr='value'])
faster: $("input").not("[name='newsletter']")
Exclude one exact attribute value — remembering that missing attributes also match.
Choose the attribute and the value to exclude.
For demos: $("input[name!='newsletter']").
For production: $("input").not("[name='newsletter']") (official performance tip).
Expect matches for other values and elements without the attribute.
Piece
Required?
Role
attribute
Yes
Attribute name to test
value
Yes
Exact value to exclude
CSS base + .not()
Recommended
Faster than bare != in modern browsers
Pseudocode
Pseudocode
attrName = given attribute
excluded = given value
matches = empty list
for each element:
if element does not have attrName:
add element // missing attr matches
else if element.getAttribute(attrName) != excluded:
add element // different value matches
return jQuery(matches)
Reference
Cheat Sheet
Keep these facts handy while excluding attribute values.
Topic
Detail
Syntax
$("[attr!='value']")
Matches
Missing attr, or attr ≠ value
Classic use
$("input[name!='newsletter']")
Equivalent
:not([attr='value'])
Faster form
$("sel").not("[attr='value']")
vs =
= is exact only; != is the inverse set
Since
jQuery 1.0 (extension, not CSS)
Try it
Live Preview
Compare !=, =, and .not() against sample inputs and see which names match.
Sample markup mirrors the official jQuery name!='newsletter' demo.
Result
$("input[name!='newsletter']")
matched: 3
names: (none), accept, (none)
/* missing name OR name ≠ newsletter */
Code
jQuery Examples
Short, copy-ready snippets. Open a browser with jQuery loaded, or use Try It Yourself for a live editor.
Example 1 — Official Demo: input[name!="newsletter"]
List inputs that are not named newsletter (including those with no name).
checkbox, radio, radio, submit
count: 4
(text input is skipped)
How It Works
Exclude one type.type!='text' drops text fields.
Keep others. Checkbox, radio, and submit remain.
List types. Mapping shows the remaining control kinds.
Production tip. Prefer $("input").not("[type='text']") for speed.
Edge Cases & Pitfalls
Check these before relying on != in real projects.
missing
Missing attributes match
[name!="x"] includes elements with no name. To require the attribute, use $("[name]").not("[name='x']").
perf
Bare != is slower
Official tip: use $("sel").not("[attr='value']") so the first pass can use native CSS selection.
ext
Not standard CSS
!= is a jQuery extension. Native querySelectorAll cannot run it directly.
case
Case-sensitive exclusion
name="Newsletter" is not equal to newsletter, so it still matches [name!="newsletter"].
Compatibility
Browser Support
The attribute not-equal selector [attr!="value"] is a jQuery extension since 1.0 — not standard CSS. It works wherever full jQuery runs; for speed, prefer .not("[attr='value']").
✓ jQuery 1.0+ · Extension
jQuery [name!="value"]
Supported in all browsers that run jQuery. Not available in native querySelectorAll. Recommended: $("input").not("[name='newsletter']").
100%With jQuery
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
!= extensionjQuery only
Bottom line: Works everywhere jQuery runs. For modern performance, select with CSS first, then .not("[attr='value']").
Analysis
Performance Notes
Approach
Cost
Best for
$("input").not("[name='x']")
CSS pass + filter
Recommended (official tip)
$("input[name!='x']")
Sizzle extension path
Small demos
$(":not([name='x'])")
Similar intent
When you already use :not()
Official docs: because != is not CSS, it cannot use querySelectorAll. Narrow with a pure CSS selector first, then .not().
Remember
Key Takeaways
Role: exclude one exact attribute value (missing attrs match too).
Classic use:$("input[name!='newsletter']") from the official demo.
Speed: prefer $("sel").not("[attr='value']").
Extension: not standard CSS — jQuery only.
One line: use != (or better, .not()) to exclude one exact attribute value — and remember missing attributes match.
Frequently Asked Questions
It selects elements that either do not have the specified attribute, or have that attribute with a value that is not exactly equal to the given string. For example, [name!="newsletter"] matches inputs with no name and inputs where name is accept — but not name="newsletter".
No. It is a jQuery extension added in version 1.0. It is equivalent to :not([attr="value"]) in intent, but it is not part of the CSS specification and cannot use native querySelectorAll optimizations.
Yes. An input with no name attribute matches [name!="newsletter"] because it does not have name="newsletter".
Use a CSS selector plus .not(): $("input").not("[name='newsletter']"). This lets jQuery use native querySelectorAll for the first pass, then filter out matches.
Yes. Comparison follows the same case-sensitive rules as [attr="value"]. name="Newsletter" does not equal newsletter and would match [name!="newsletter"].
[name="newsletter"] matches only elements whose name is exactly newsletter. [name!="newsletter"] matches everything else — including elements with no name attribute.