How to create an image acting as a submit button using HTML5 ?
In this article, we will learn how to create an image that acts as a submit button i.e. whenever we click on an image in the form, it will be automatically submitted to the server. The default type of <input> type attribute is text. Here, we use a simple approach to complete the task.
<input type = "image">
- image: It is used to define an image as the submit button.
- The input element does not accept a value attribute.
- The image path is defined in the src attribute.
- The input element is supported by various common attributes.
- Firstly, create an HTML document that contains an <input> tag.
- use the type attribute with the <input> tag.
- set the type attribute to value “image“.
- You can also use the src attribute which contains the URL of the image.
Example: This example illustrates the use of the image button in the input type to submit the login details in HTML Form.
Example: In this example, we have used the input type as an image for the newsletter subscription button in HTML.