Input Types

HTML input type="image"

Build a form with the HTML form generator

Submit the associated form with click coordinates. Provide alternative text as the accessible label. A named image submitter contributes name.x and name.y coordinates. Use a meaningful alt label and consider a conventional button when coordinates are unnecessary. Use only attributes applicable to this input state; the browser ignores or rejects unrelated constraints. Validate submitted data on the server.

Formal Syntax & Structure

html syntaxhtml
<input type="image">

Parameters & Attributes

NameTypeDescription
typeliteral imageSelects the image input state.
namestringProvides an element-specific name: a form field key, radio group name, named frame, metadata key, slot name or other defined purpose. Its meaning depends on the element; it is not a unique DOM identifier.
disabledbooleanDisables supported controls or elements. Disabled form controls are generally not focusable, validated or submitted. The exact effect depends on the element; disabled="false" still disables.
formform element IDAssociates an eligible control with a form elsewhere in the same document, overriding an ancestor form where applicable. Does not automatically associate descendants of a fieldset.
srcURLSpecifies the resource to load for the given element, such as an image, script or media file. The resource type, loading behavior and security rules depend on the element.
alttextText alternative for image submit controls; not used on ordinary text inputs.
widthnon-negative integerDefines element-specific width, commonly in CSS pixels. On images it can establish an intrinsic aspect ratio together with height; on canvas it sets the bitmap width.
heightnon-negative integerSets an element-specific height, commonly in CSS pixels. On images, pair it with width matching the intrinsic aspect ratio to reserve layout space. It is not a CSS length with units.
formactionURLOverrides the associated form's submission destination for this submit button or image submit input.
formenctypeform encoding keywordOverrides the associated form's encoding when this submit control initiates submission. Use multipart/form-data for file upload requests.
formmethodenumerated: get, post, dialogOverrides the form submission method for a particular submit control. dialog closes an associated dialog instead of making an ordinary network submission.
formnovalidatebooleanBypasses native constraint validation when the corresponding submit control is used. Server-side validation is still required.
formtargetbrowsing context name or keywordOverrides the target browsing context for the submission initiated by this control.

Return Value

HTMLInputElement

Void form-associated element; no child content. The DOM value and form-submission behavior depend on the input state.

Working Example

Example Snippethtml
<form method="get">  <input type="image" name="pick" alt="Submit selection" width="90" height="32" src="data:image/svg+xml,%3Csvg xmlns=%27http://www.w3.org/2000/svg%27 width=%2790%27 height=%2732%27%3E%3Crect width=%2790%27 height=%2732%27 fill=%27lightblue%27/%3E%3Ctext x=%2710%27 y=%2720%27%3ESubmit%3C/text%3E%3C/svg%3E"></form>
HTML Reference