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.
altis optional for theinputtag., although it would be needed for accessibility should theinputbe animg.For example:
<input type="image" src="image.jpg" alt="Submit" />.In this case, css or some script may be switching out the
valuefor 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.