The attribute starts-with selector matches elements whose attribute value begins exactly with a given string (prefix). Available since jQuery 1.0 (standard CSS3).
Remember
$("[attribute^='value']")
$("input[name^='news']")
✓ name="newsletter"
✓ name="newsboy"
✗ name="milkman" (starts with "milk")
✗ name="Newsletter" (case differs)
^= ≠ $= // $= is end only
^= ≠ *= // *= is anywhere
Name the attribute, pick a prefix, then query — casing must match exactly.
Choose the attribute (name, href, id, …).
Write $("[attr^='prefix']") — or with a tag: $("input[name^='news']").
Confirm the value truly starts with that string (not just contains it).
Watch case: news and News are different prefixes.
Piece
Required?
Role
attribute
Yes
Attribute name to test
value
Yes
Exact prefix the value must begin with
Quotes around value
Recommended
Required for many values; identifiers may omit them
Pseudocode
Pseudocode
attrName = given attribute
prefix = given value
matches = empty list
for each element with attrName:
v = element.getAttribute(attrName)
if v starts with prefix: // case-sensitive
add element
return jQuery(matches)
Reference
Cheat Sheet
Keep these facts handy while matching attribute prefixes.
Topic
Detail
Syntax
$("[attr^='value']")
Matches
Value beginning exactly with the prefix
Classic use
$("input[name^='news']")
HTTPS links
$("a[href^='https://']")
ID prefixes
$("[id^='ctl00_']") (framework IDs)
Case
Sensitive (news ≠ News)
vs $= / *=
End only / anywhere
Since
jQuery 1.0 (CSS3)
Try it
Live Preview
Run starts-with / ends-with / contains selectors against sample inputs and see which name values match.
Sample markup mirrors the official jQuery name^='news' demo, plus HTTPS link examples.
newsletter, newsboy
(milkman skipped; matched values become "news here!")
How It Works
Limit to inputs. The input tag keeps the search on form controls.
Apply ^=. Only names that begin with news match.
Skip mid-word hits. A name like my_news would fail — prefix must be first.
Set values..val() updates every prefix match in one call.
Example 2 — ^= vs $=
Contrast starting with news against ending with news.
jQuery
console.log("^= :", $("input[name^='news']").length);
console.log("$= :", $("input[name$='news']").length);
// ^= matches newsletter, newsboy
// $= matches none in the official sample (no name ends with "news")
row-1, row-2
(panel-row is skipped — prefix, not suffix)
How It Works
Any element. Omitting a tag searches every node with an id.
Shared start. Both row-1 and row-2 begin with row-.
Order matters.panel-row fails because it starts with panel.
Prefer classes. Official docs note classes are usually faster for grouping.
Example 5 — Case Sensitivity
Official rule: the comparison is case sensitive — casing must align.
jQuery
console.log("news :", $("input[name^='news']").length);
console.log("News :", $("input[name^='News']").length);
// name="Newsletter" matches only the second query
news : 2
News : 1
Lowercase "news" does not match name="Newsletter"
How It Works
Same letters, different case. Selectors compare the prefix as written.
Lowercase query. Matches values starting with lowercase news.
Capitalized query. Matches values starting with News.
Habit. Keep prefixes consistent in markup when possible.
Edge Cases & Pitfalls
Check these before relying on ^= in real projects.
case
Case-sensitive by design
Official docs state the comparison is case sensitive. news and News need separate selectors (or normalized values).
trap
Contains ≠ starts with
my_news contains news but fails ^=. Use *= if the fragment can sit anywhere.
perf
Classes beat attribute prefixes
Official API tip: systematic IDs work with ^=, but grouping with a class is usually faster.
empty
Empty prefix is a trap
[attr^=""] can match every element that has that attribute. Avoid empty search strings.
Compatibility
Browser Support
The attribute starts-with selector [attr^="value"] is part of CSS3 and has worked in jQuery since 1.0. Modern browsers implement it in native querySelectorAll.
✓ CSS3 · jQuery 1.0+
jQuery [name^="value"]
Supported in all modern browsers. Native: document.querySelectorAll("input[name^='news']"). Case-sensitive prefix matching.
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
^= combinatorUniversal
Bottom line: Safe everywhere jQuery runs. Ideal for prefixes, schemes, and systematic IDs — keep casing consistent in markup and selectors.
Analysis
Performance Notes
Approach
Cost
Best for
$("input[name^='news']")
Native-friendly CSS
Scoped form controls
$("a[href^='https://']")
Native-friendly CSS
Scheme / URL filters
$("[id^='row-']")
Wider scan
Any element with that id prefix
$(".group")
Usually faster
Prefer classes when you control markup
Attribute selectors are standard CSS, so jQuery can often use the browser engine. Narrow with a tag or a container on large pages — and prefer a class when you can add one.
Remember
Key Takeaways
Role: match attributes whose value starts with an exact prefix.
Classic use:$("input[name^='news']") from the official demo.
Case-sensitive:news ≠ News.
Not *=: starting with ≠ containing somewhere in the middle.
One line: use [attr^="value"] for exact, case-sensitive prefix matches — great for schemes, naming starts, and systematic IDs.
Frequently Asked Questions
It selects elements whose named attribute value begins exactly with the given string. For example, [name^="news"] matches name="newsletter" and name="newsboy" because those values start with the prefix news.
Yes. Per the official jQuery API, the comparison is case sensitive. name="Newsletter" does not match [name^="news"] because the casing differs at the start.
[attr^="https"] matches only when the value starts with https. [attr*="https"] matches https anywhere. [attr$=".pdf"] matches values that end with .pdf.
Yes. The attribute starts-with selector is standard CSS3 and has worked in jQuery since 1.0, with native querySelectorAll support in modern browsers.
Yes. a[href^="https://"] is a common pattern for URLs that begin with the https:// scheme.
No. The prefix must be the first characters of the value. my_news starts with my_, not news. Use [name*="news"] if the substring may appear in the middle.