What is the purpose of the "Image" input?

7

I've just now realized that there is a input attribute with type equal to "image" .

I saw this being used on some site (pretty old by the way) to submit a form.

I have the following questions:

  • What is the purpose of this input[type=image] ?
  • Is it just for submitting a form?
  • This attribute should be avoided, or it can still be used quietly (are we in 2017 just for the date)?

Reference: MDN - Input Type Image

    
asked by anonymous 13.04.2017 / 18:51

1 answer

7

It's to make a "cute" submission button using an image instead of the default button. It has become unnecessary since HTML5 since all document objects can be stylized in other ways.

And it does not even work as expected from a button in all situations (it may not send the value of the button but rather the coordinates from where it was clicked which is hardly relevant in almost all cases and takes out a possible information that matters) , then avoid it. Prefer button doing what it should to do.

This was created by gambiarra to solve a problem without thinking about the whole thing.

    
13.04.2017 / 18:57