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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With