jQuery :image Selector

Beginner
⏱️ 8 min read
📚 Updated: Jul 2026
🎯 5 Examples
🚀 5 Try-it labs
jQuery extension · jQuery 1.0+

What You’ll Learn

The :image selector matches every input[type="image"] element — graphical submit buttons in forms. jQuery extension since 1.0; equivalent to [type="image"]; does not match <img> tags.

01

Syntax

input:image

02

Type

image input

03

Official

Style & count

04

[type=]

Equivalent

05

Not img

Use $("img")

06

Scope

Form prefix

Introduction

HTML forms can use graphical submit buttons — <input type="image" src="…" alt="Submit"> — instead of plain text buttons. When you need to style every image submit control or attach click handlers, jQuery’s :image pseudo-class gathers them in one expression.

jQuery has supported :image since version 1.0. Official documentation describes it as selecting all elements of type image and states it is equivalent to [type="image"]. Because it is a jQuery extension, prefer input[type="image"] when you need native querySelectorAll speed in modern browsers.

Understanding the :image Selector

:image filters by the input’s type attribute:

  • <input type="image" src="go.png"> + input:image → matches.
  • <input type="submit"> + input:image → no match.
  • <img src="photo.jpg"> + input:image → no match (use $("img")).
  • <button type="submit"> + input:image → no match.
💡
Beginner Tip

The name :image sounds like picture tags, but it only targets image submit inputs. Content images use the img element selector.

📝 Syntax

Official jQuery API form (since 1.0):

jQuery
jQuery( ":image" )

// recommended — prefix with input:
$( "input:image" )

// scoped to a form:
$( "#searchForm input:image" )

// CSS-equivalent (native querySelectorAll):
$( "input[type='image']" )

Parameters

  • None:image takes no arguments. It always means type="image" on an input element.

Return value

  • A jQuery object containing every matched image input in document order within the search scope.
  • Empty collection when no image inputs exist.

Official jQuery API example

jQuery
var input = $( "input:image" ).css({
  background: "yellow",
  border: "3px red solid"
});
$( "div" ).text( "For this type jQuery found " + input.length + "." );

⚡ Quick Reference

GoalSelectorMatches
All image inputs$("input:image")input[type=image]
Native CSSinput[type="image"]Same nodes
Picture elements$("img")Not :image
Form scope$("#form input:image")One form
Text submitinput:submitDifferent type

📋 :image vs img, :button, and [type="image"]

Form submit graphics vs content pictures vs other control types.

:image
input:image

Submit input

img
$("img")

Content pics

[type=]
[type="image"]

Native CSS

:button
input:button

Plain button

Examples Gallery

Example 1 follows the official jQuery input:image demo. Examples 2–5 cover attribute equivalence, the img vs input distinction, scoped form queries, and click coordinates.

📚 Official jQuery Demo

Style image inputs and report how many were found.

Example 1 — Official Demo: input:image

Official jQuery demo — yellow background and red border on image inputs; count displayed in a div.

jQuery
var input = $( "input:image" ).css({
  background: "yellow",
  border: "3px red solid"
});
$( "div" ).text( "For this type jQuery found " + input.length + "." );
Try It Yourself

How It Works

Only input elements with type="image" match — text fields, checkboxes, and regular buttons are skipped.

Example 2 — Equivalent: input[type="image"]

Official docs — attribute selector produces the same matches with native CSS performance.

jQuery
console.log( ":image →", $( "input:image" ).length );
console.log( "[type=image] →", $( "input[type='image']" ).length );
Try It Yourself

How It Works

:image is jQuery shorthand. Modern code often uses input[type="image"] for querySelectorAll compatibility.

📈 Practical Patterns

Distinguish img tags, scope forms, handle clicks.

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

Picture elements in content do not match the :image pseudo-class.

jQuery
console.log( "input:image →", $( "input:image" ).length );
console.log( "img tag →", $( "img" ).length );
Try It Yourself

How It Works

Both may show images on screen, but only input[type="image"] is a form control matched by :image.

Example 4 — Scoped: $("#cartForm input:image")

Style image submit buttons in one form only — skip other forms on the page.

jQuery
$( "#cartForm input:image" ).css( "outline", "3px solid #2563eb" );
Try It Yourself

How It Works

Prefix with form id or class — avoids styling every image input on a multi-form page.

Example 5 — Click Coordinates on Image Submit

Image inputs submit the form and include x/y click coordinates in the request.

jQuery
$( "input:image" ).on( "click", function ( e ) {
  console.log( "Clicked at", e.pageX, e.pageY );
});
Try It Yourself

How It Works

Unlike plain submit buttons, image inputs behave like clickable maps — useful for image-map-style forms in legacy UIs.

🚀 Common Use Cases

  • Form styling — highlight all input:image controls as in the official demo.
  • Multi-form pages — scope with $("#formId input:image").
  • Accessibility — verify every image input has an alt attribute.
  • Legacy UIs — image-map submit buttons with coordinate data.
  • Validation — count image submits before enabling a wizard step.
  • Performance — prefer input[type="image"] for native selectors.

🧠 How jQuery Evaluates :image

1

Build candidate set

Evaluate prefix — input:image or scoped form selector.

Query
2

Check type attribute

Keep inputs where type equals image — same rule as [type="image"].

Filter
3

Preserve order

Return matches in document order within the search context.

Sort
4

Chain methods

Apply .css(), .on("click"), or read .length.

📝 Notes

  • Available since jQuery 1.0 — jQuery extension, not bare CSS pseudo-class.
  • Equivalent to [type="image"] — official jQuery documentation.
  • Matches input[type="image"] only — not <img> elements.
  • Prefer input:image over bare $(":image") (implies *:image).
  • Image inputs submit forms like submit buttons, plus optional x/y coordinates.
  • Always provide meaningful alt text for accessibility.

Browser Support

The :image pseudo-class is a jQuery extension and works in jQuery 1.0+. input[type="image"] controls are supported in all modern browsers. For native selector speed, use the attribute form input[type="image"].

jQuery 1.0+ · extension

jQuery :image Selector

Form image submit inputs — not content img tags.

100% jQuery + HTML
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: Use input:image or input[type=image] scoped to your form.

Conclusion

The :image selector matches every <input type="image"> submit control. The official demo styles them with a yellow background and red border, then reports how many were found.

Remember it does not select <img> tags, prefix with input, and prefer input[type="image"] when you need native CSS selector performance.

💡 Best Practices

✅ Do

  • Use $("#form input:image") for scoped queries
  • Prefer input[type="image"] for native performance
  • Use $("img") for content pictures
  • Set alt on every image input
  • Prevent default submit when demoing click handlers

❌ Don’t

  • Expect :image to match <img> tags
  • Use bare $(":image") on large documents
  • Confuse :image with :button or :submit
  • Forget image inputs submit the form on click
  • Use :image in native CSS stylesheets — jQuery-only

Key Takeaways

Knowledge Unlocked

Five things to remember about :image

Input type image — not img tags.

5
Core concepts
[type] 02

Equivalent

Native CSS

Rule
img 03

Not img

Different tag

Tip
demo 04

Official

input:image

Demo
form 05

Scope

#form prefix

Perf

❓ Frequently Asked Questions

:image selects every input element whose type attribute 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 — equivalent to $("*:image") — which scans every element type. Official docs recommend prefixing with input or scoping to a form.
No. It is a jQuery extension since version 1.0. Native querySelectorAll cannot run :image directly. Use input[type="image"] for standard CSS attribute matching.
:image matches only input[type="image"]. :button matches button tags and input[type="button"]. :submit matches input[type="submit"] and button[type="submit"]. An image input is its own control type.
Did you know?

When a user clicks an input[type="image"], the browser submits the form with extra fields — name.x and name.y — recording where they clicked on the graphic. That made image inputs popular for server-side image maps before client-side canvas apps became common.

Continue to :reset Selector

Learn how to select form reset buttons that restore default field values.

:reset selector 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.

6 people found this page helpful