Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the point of the alt parameter on submit button?

Tags:

html

forms

I was recently looking at some code in a book and in the form for a page they had:

<input type="submit" value="Add To Cart" name="submit" alt="Add To Cart" />

I understand that the input is there if you use images as buttons. But is there any reason why it is here in this example or are they just covering bases.

like image 398
Cubed Eye Avatar asked Oct 27 '25 08:10

Cubed Eye


1 Answers

I think they are simply covering bases here.

alt is optional for the input tag., although it would be needed for accessibility should the input be an img.

For example: <input type="image" src="image.jpg" alt="Submit" />.

In this case, css or some script may be switching out the value for an image, or as a I suggested already, the book is simply adding all the attributes you would use if you were coding completely to spec.

like image 91
Jason Gennaro Avatar answered Oct 29 '25 22:10

Jason Gennaro



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!