Skip to content Skip to sidebar Skip to footer

Can The Alt Attribute Be Used For An Input Type Button

I wanna ask about the alt attribute in an input tag. As I found on many sites, the alt attribute is used when we have an input with type image. 1/ Can it be used for an input type

Solution 1:

For anyone else looking for the attribute that defines the mouse hover tooltip text -- you are looking for title, not alt, as asked and answered in tooltips for Button.

The title attribute documentation page at https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title (MDN) also has a few notes about accessibility issues for the tooltip effect on mouse over and suggests some alternative techniques.

Solution 2:

  1. No
  2. It doesn't have one

The only kind of input that can have an alt attribute is type="image" where it provides a text alternative for when the image can't be rendered (e.g. because it failed to load, because the browser doesn't support images, or because the user is employing screen reader software (usually to compensate for a vision related disability)).

Solution 3:

See http://www.w3schools.com/tags/att_input_alt.asp I quote

The alt attribute provides an alternate text for the user, if he/she for some reason cannot view the image (because of slow connection, an error in the src attribute, or if the user uses a screen reader).

Note: The alt attribute can only be used with <input type="image">.

So, no. And since it cannot be used with a button, it has no meaning.

Solution 4:

For a button class I found it was title="Copy to clipboard" that worked for me.

Post a Comment for "Can The Alt Attribute Be Used For An Input Type Button"