Robbert29
Robbert29

Reputation: 23

Modifying HTML Code

I have this HTML code:

<input type="button" value="OK">

When people click on the button, users go to the next step.

I also have an image that I would like to do the same thing. I want it so when the user clicks on the image, it will also go to the next step. I've tried to edit the code but with no luck.

Here is the image code attempt:

<img src="black-white.gif" alt="BJ" value="OK">

Can anyone tell me what would I need to add to the image code so that it does the same thing as the button code?

Upvotes: 0

Views: 63

Answers (3)

Erubiel
Erubiel

Reputation: 2972

use <button> tag instead

like this

<button type="button">Ok</button>

<button type="button">
   <img src="https://via.placeholder.com/100x100">
</button>

Or if you are submitting a form with the button

<button type="submit">Ok</button>

<button type="submit">
   <img src="https://via.placeholder.com/100x100">
</button>

Upvotes: 1

J.Diaz
J.Diaz

Reputation: 1

You should try using Image submit button:

<input type="image" src="theimagesource.jpg" alt="Submit Form" />

Upvotes: 0

Ojasvi Bhargava
Ojasvi Bhargava

Reputation: 312

<input type="image" src="submit.gif" alt="Submit" width="48" height="48"> will work.

References - https://www.w3schools.com/tags/tryit.asp?filename=tryhtml_input_src

Upvotes: 0

Related Questions