jQuery :image Selector

Beginner
6 min read
Updated: Oct 2026
5 examples
Live preview

What Is :image?

:image (since jQuery 1.0) selects every <input type="image"> — a graphical form submit control that looks like a picture. Official docs state it is equivalent to [type="image"]. It does not match <img> tags. Always prefer $("input:image") over bare $(":image").

Remember
$("input:image")              // all image inputs
$("form input:image")         // image inputs inside a form
$("input[type=image]")        // equivalent attribute form
$("img")                      // content pictures — different!

// Avoid on large pages:
$(":image")                   // implies *:image
NeedUse
All image inputs$("input:image")
Inside one form$("#checkout input:image")
Native speed$("input[type=\"image\"]")
Content pictures$("img") — not :image
Text submit instead$("input:submit")

How to Use :image

Prefix with input, scope to a form, then style, count, or bind click handlers.

  1. Write $("input:image") — never bare $(":image") on large pages.
  2. Scope to a form: $("#pay input:image").
  3. Remember: this is a submit control, not an <img> element.
  4. Style or bind events on the matches (official demo uses .css()).
  5. For hot paths, prefer input[type="image"] so the browser can optimize.
PieceRequired?Role
Selector stringYes:image filter (best with an input prefix)
Form / contextOptionalAvoids image inputs in unrelated widgets
src / altHTML attrsPicture and accessible label for the control
Return value—jQuery collection of matching image inputs (may be empty)

Pseudocode

Pseudocode
matches = []
for each element in search context:
    if element.tag is input
       and element.type is "image":
        matches.add(element)

return matches

// Does NOT match <img> elements

Cheat Sheet

Keep these facts handy while selecting image inputs.

TopicDetail
Syntax$("input:image")
SincejQuery 1.0 · jQuery extension
Equivalent$("[type=image]")
Matchesinput type="image" only
vs $("img")Different — content images vs form control
vs :submitText/submit buttons — separate type
RoleGraphical form submit
Native CSSUse [type="image"] for speed

Live Preview

Run different selectors against a small sample form and see how many image inputs match.

Sample markup mirrors the official jQuery form demo (text, checkbox, button, image input) plus an img and submit for contrast.

Result
$("input:image")
matched: 1

/* image input only — img tag ignored */

jQuery Examples

Short, copy-ready snippets. Open DevTools Console with jQuery loaded, or use Try It Yourself for a live editor.

Example 1 — Official Demo: input:image

Style image inputs and print the match count (jQuery API example).

jQuery
var input = $("input:image").css({
  background: "yellow",
  border: "3px red solid"
});

$("#count").text("For this type jQuery found " + input.length + ".");
Try It Yourself

How It Works

  1. Select. input:image finds every image-type input.
  2. Filter. Only type="image" matches — other inputs are ignored.
  3. Style. Official demo applies a yellow background and red border.
  4. Report. .length is how many image inputs were found.

Example 2 — Equivalence: :image vs [type=image]

Official docs — both forms select the same elements.

jQuery
var a = $("input:image").length;
var b = $("input[type=image]").length;

console.log("input:image →", a);
console.log("[type=image] →", b);
console.log("same set?", a === b);
Try It Yourself

How It Works

  1. Pseudo. :image is the jQuery shorthand for image-type inputs.
  2. Attribute. [type=image] is the standard CSS equivalent.
  3. Compare. Matching lengths mean both forms found the same nodes.
  4. Choose. Prefer the attribute form when native speed matters.

Example 3 — input:image vs $("img")

Image inputs and content pictures are different element types.

jQuery
console.log("image inputs:", $("input:image").length);
console.log("img tags:", $("img").length);

$("input:image").each(function () {
  this.title = "form control";
});
$("img").each(function () {
  this.title = "content picture";
});
Try It Yourself

How It Works

  1. Form control. :image keeps input type="image" only.
  2. Content. $("img") keeps picture elements in the page.
  3. No overlap. An element never matches both selectors.
  4. Titles. Setting title makes the split easy to inspect.

Example 4 — Click Handler on Image Inputs

Bind a click on every image submit without touching other buttons.

jQuery
$("form").on("submit", function (e) {
  e.preventDefault();
});

$("input:image").on("click", function () {
  $("#out").text("Clicked image input: " + (this.alt || this.name || "unnamed"));
});
Try It Yourself

How It Works

  1. Prevent submit. Stop the form so the page does not navigate.
  2. Scope. input:image binds only to graphical submit controls.
  3. Click. The handler runs when the user activates that control.
  4. Label. alt (or name) identifies which image input fired.

Example 5 — Native Performance: input[type="image"]

Official tip — use the attribute selector so modern browsers can optimize.

jQuery
var $imgs = $("input[type='image']");
$("#out").text("Found " + $imgs.length + " image input(s) via [type=image]");

// Pure DOM (no jQuery pseudo-class):
// document.querySelectorAll("input[type='image']")
Try It Yourself

How It Works

  1. Standard CSS. [type="image"] is valid in native selectors.
  2. Same matches. You still get every image input.
  3. Engine boost. jQuery can hand the query to querySelectorAll.
  4. When to switch. Prefer this form on large pages or hot update paths.

Edge Cases & Pitfalls

Check these before relying on :image in real forms.

slow

Bare $(":image") scans everything

It implies *:image. Prefer $("input:image") or a form-scoped query.

non-std

Not valid in querySelectorAll

:image is a jQuery extension. Use input[type="image"] for native CSS queries.

confuse

:image ≠ $("img")

Content pictures use the img element selector. :image is only the form control.

a11y

Always set alt

Image inputs need a meaningful alt (like a submit label) for screen readers.

Browser Support

The :image pseudo-class is a jQuery extension and has worked since jQuery 1.0. The equivalent input[type="image"] attribute selector is standard CSS and runs in native querySelectorAll.

✓ jQuery 1.0+ · extension

jQuery :image Selector

Supported across jQuery 1.x, 2.x, and 3.x wherever your jQuery build runs. Prefer input:image; use input[type="image"] for native speed.

100% jQuery + native attr
Google Chrome All versions · Desktop & Mobile
Full support
Mozilla Firefox All versions · Desktop & Mobile
Full support
Apple Safari All versions · macOS & iOS
Full support
Microsoft Edge All versions · Chromium & Legacy
Full support
Internet Explorer IE 6+ · Legacy environments
Full support
Opera All modern versions
Full support
:image Universal

Bottom line: Safe everywhere jQuery runs. Prefer $("input:image"); use [type="image"] when performance matters. Do not confuse with $("img").

Performance Notes

ApproachCostBest for
$("input[type=\"image\"]")FastestModern browsers / hot paths
$("input:image")CheapTypical tutorials and small forms
$("#form input:image")CheaperMulti-form pages
$(":image")SlowerAvoid — universal scan

Official jQuery docs note that because :image is not CSS, it cannot use the querySelectorAll boost. Prefer [type="image"] when the page is large or you re-query often.

Key Takeaways

  • Role: select every input type="image" (graphical submit) in scope.
  • Prefix: use $("input:image"), not bare $(":image").
  • Not img: content pictures use $("img") — a different selector.
  • Speed: prefer [type="image"] when native performance matters.

One line: $("input:image") finds graphical submit controls — not <img> tags — and [type="image"] is faster on large pages.

Frequently Asked Questions

:image selects every input whose type is image — graphical submit buttons rendered as pictures. $("input:image") finds all image inputs in the search context. Available since jQuery 1.0.
No. :image matches input[type="image"] only — form submit controls. To select picture elements in content, use the element selector $("img") instead.
Yes. Official jQuery docs state that :image is equivalent to [type="image"]. For native querySelectorAll performance in modern browsers, prefer input[type="image"] over the :image pseudo-class.
Prefer $("input:image"). Bare $(':image') implies the universal selector and scans as $('*:image'), which is slower on large pages. Official docs recommend prefixing with input or scoping to a form.
:image matches only input[type="image"]. :submit matches submit buttons (input or button). :button matches button tags and input[type="button"]. An image input is its own control type.
No. It is a jQuery extension (not part of the CSS specification), so queries using :image cannot use the native querySelectorAll boost. Use [type="image"] when performance matters.

Next: :reset Selector

Learn how to select reset buttons in forms with the :reset selector.

:reset tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

9 people found this page helpful