jQuery :image Selector

Beginner
5 min read
Updated: Nov 2026
3 examples
Selectors

Definition

: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").

Syntax

Start with these common calls. Keep them short and readable.

jQuery
$("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
CallWhat it does
Selector string:image filter (best with an input prefix)
Form / contextAvoids image inputs in unrelated widgets
src / altPicture and accessible label for the control
Return valuejQuery collection of matching image inputs (may be empty)

Load jQuery before your script (CDN or local file), then wrap DOM work in $(function () { ... }) when needed.

Parameters

ParameterDescription
Step 1Write $("input:image") — never bare $(":image") on large pages.
Step 2Scope to a form: $("#pay input:image").
Step 3Remember: this is a submit control, not an <img> element.

Return Value

Return ValueDescription
See examplesCheck the examples below for what this API returns in common cases.

jQuery Examples

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.

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.

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.

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 — Select Reset Buttons

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

:reset Selector — Select Reset Buttons tutorial →

CODETOFUN NEWS

Stay Ahead in Tech

Get the latest IT news, programming updates, and technology trends directly on your phone.

Your daily dose of tech, straight to your feed.

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