:text (since jQuery 1.0) selects <input> elements of type text. Prefer $("input:text") over bare $(":text"). Since 1.5.2, it also matches inputs with notype attribute (text is implied).
Remember
$("input:text") // recommended
$("form input:text") // official demo style
$("input[type=text]") // explicit attribute only
$(":text") // avoid — implies *:text
// Since 1.5.2:
$("<input>").is(":text") // true (no type → text)
$("<input>").is("[type=text]") // false
// Not textarea — use $("textarea")
Prefix with input, scope to a form, then style, clear, or read values.
Write $("input:text") — not bare $(":text").
Scope to a form: $("#signup input:text").
Remember typeless <input> elements count as text since 1.5.2.
Do not expect textarea matches — select those separately.
For native speed with explicit types only, use input[type="text"].
Piece
Required?
Role
Selector string
Yes
:text (best with an input prefix)
Form context
Optional
Limits matches to one form
Return value
—
jQuery collection of matching text inputs
Pseudocode
Pseudocode
matches = []
for each input in search context:
if type is "text"
OR type attribute is missing (since 1.5.2):
matches.add(input)
return matches
// [type=text] skips missing-type inputs
Reference
Cheat Sheet
Keep these facts handy while selecting text fields.
Topic
Detail
Syntax
$("input:text")
Since
jQuery 1.0 · extension (typeless since 1.5.2)
Matches
input with type text (or missing type)
Not
textarea, password, email, number, …
vs [type=text]
Attribute form skips typeless inputs
vs .text()
Method for text content — different API
Prefix
Always prefer input:text
Native CSS
Use [type="text"] for speed
Try it
Live Preview
Run different selectors against a small sample form and compare :text with [type=text].
Sample includes typed text, typeless input, password, and textarea — mirrors the official form demo idea.
Short, copy-ready snippets. Open DevTools Console with jQuery loaded, or use Try It Yourself for a live editor.
Example 1 — Official Demo: form input:text
Count text inputs in a form (jQuery API example idea).
jQuery
var input = $("form input:text");
$("#count").text("For this type jQuery found " + input.length + ".");
$("form").on("submit", function (e) { e.preventDefault(); });
input:text → 2
[type=text] → 1
typeless is :text? true
typeless is [type=text]? false
How It Works
:text. Includes typed and typeless text inputs.
Attribute.[type=text] needs the attribute written in HTML.
.is(). Official docs show this exact true/false contrast.
Choose. Use :text when typeless inputs must count.
Example 3 — Prefer input:text Over Bare :text
Official tip — prefix pseudo-classes so you do not imply *:text.
jQuery
console.log("input:text →", $("input:text").length);
console.log(":text →", $(":text").length);
// Same matches here, but input:text is clearer and safer on large pages
[type=text]: 1
input:text: 2
(counts differ if typeless inputs exist)
How It Works
Native.[type="text"] is standard CSS.
Faster. jQuery can hand it to querySelectorAll.
Trade-off. You miss typeless inputs that :text includes.
Rule. Need every text field including bare <input>? Keep :text.
Edge Cases & Pitfalls
Check these before relying on :text in real forms.
typeless
:text ≠ [type=text]
Since 1.5.2, typeless <input> matches :text only. Do not swap them blindly.
slow
Bare $(":text") scans widely
It implies *:text. Prefer $("input:text") or a form-scoped query.
textarea
Not a textarea selector
Multi-line fields need $("textarea"). :text never matches them.
name
Do not confuse with .text()
:text selects inputs. .text() reads/writes text content on any element.
Compatibility
Browser Support
The :text pseudo-class is a jQuery extension and has worked since jQuery 1.0 (typeless-input behavior since 1.5.2). Prefer input[type="text"] when you want native querySelectorAll performance.
✓ jQuery 1.0+ · extension
jQuery :text Selector
Supported across jQuery 1.x, 2.x, and 3.x. Prefer input:text; use [type="text"] for native speed when typeless inputs do not matter.
100%jQuery form 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
:textUniversal
Bottom line: Safe everywhere jQuery runs. Prefer input:text, remember the typeless-input difference, and scope to a form on large pages.
Analysis
Performance Notes
Approach
Cost
Best for
$("input[type=\"text\"]")
Fastest
Explicit type attributes / hot paths
$("form input:text")
Cheap
Typical forms (includes typeless)
$("input:text")
Cheap
Page-wide text fields
$(":text")
Slower
Avoid — universal scan
Official docs: because :text is not CSS, it cannot use the querySelectorAll boost. Prefer [type="text"] when you only need explicit text inputs and performance matters.
Remember
Key Takeaways
Role: select single-line text input fields.
Prefix: use $("input:text"), not bare $(":text").
1.5.2+: typeless <input> matches :text, not [type=text].
Not textarea: select textarea separately; next is :checked.
One line:$("input:text") finds text fields — including typeless inputs — and is not the same as [type=text] or .text().
Frequently Asked Questions
:text selects every input element of type text — single-line text fields. Prefer $("input:text"). Available since jQuery 1.0.
Prefer $("input:text"). Bare $(':text') implies $('*:text') and scans more of the page. Official docs recommend prefixing with input.
Since jQuery 1.5.2, :text also matches <input> with no type attribute (type=text is implied). [type=text] matches only when the attribute is present. Official demo: $("<input>").is(":text") is true; .is("[type=text]") is false.
No. It selects input elements of type text only. Use $("textarea") or :input for textareas.
No. :text is a selector for text inputs. .text() gets or sets text content on elements. Same name, different jobs.
No. It is a jQuery extension, so it cannot use querySelectorAll. Prefer [type="text"] for speed when you only need explicit type=text attributes.