0

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?

2
  • Do want to perform some action after click event or you just want to go to next step? Commented Aug 25, 2018 at 13:15
  • After the click, but I already have the issue solved now. Thanks! Commented Aug 25, 2018 at 13:50

3 Answers 3

1

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>
Sign up to request clarification or add additional context in comments.

Comments

0
<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

Comments

0

You should try using Image submit button:

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

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.