Can The Alt Attribute Be Used For An Input Type Button - Stack Overflow
Có thể bạn quan tâm
-
- Home
- Questions
- Tags
- Users
- Companies
- Labs
- Jobs
- Discussions
- Collectives
-
Communities for your favorite technologies. Explore all Collectives
- Teams
Ask questions, find answers and collaborate at work with Stack Overflow for Teams.
Try Teams for free Explore Teams - Teams
-
Ask questions, find answers and collaborate at work with Stack Overflow for Teams. Explore Teams
Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about CollectivesTeams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about TeamsGet early access and see previews of new features.
Learn more about Labs can the alt attribute be used for an input type button Ask Question Asked 10 years, 3 months ago Modified 2 years, 3 months ago Viewed 36k times 12I 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 button?
<input type="button" alt="myAction.myMethod" />2/ what is its meaning?
Share Improve this question Follow asked Aug 21, 2014 at 9:39 seniorsenior 2,2566 gold badges40 silver badges57 bronze badges 5- Why would you use it with a button input anyway? – BoltClock Commented Aug 21, 2014 at 9:41
- This attribute is used for `<img> – singe3 Commented Aug 21, 2014 at 9:43
- 1 Perhaps if you mention what you want to achieve with this, hints could be given as to what tag you should be using. – Sanchises Commented Aug 21, 2014 at 9:49
- Do you actually want to ask how to set some text in an input element of type button? – Jukka K. Korpela Commented Aug 21, 2014 at 9:49
- The ask perhaps for accessibility. No, we can't add alt text because it doesn't make sense with the button, but for accessibility, we can add aria-label. – Rashid Commented Nov 5, 2021 at 16:44
4 Answers
Sorted by: Reset to default Highest score (default) Trending (recent votes count more) Date modified (newest first) Date created (oldest first) 34The attribute that defines the mouse hover tooltip text is title, not alt, as asked and answered in Tooltips for Button elements.
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.
Share Improve this answer Follow edited Aug 11, 2022 at 7:20 answered Oct 22, 2018 at 17:15 handlehandle 6,2694 gold badges60 silver badges91 bronze badges Add a comment | 4- No
- 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)).
Share Improve this answer Follow answered Aug 21, 2014 at 9:42 QuentinQuentin 941k132 gold badges1.3k silver badges1.4k bronze badges Add a comment | 2For a button class I found it was title="Copy to clipboard" that worked for me.
Share Improve this answer Follow answered Oct 21, 2021 at 14:31 SpinstazSpinstaz 3317 silver badges12 bronze badges Add a comment | 1See 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.
Share Improve this answer Follow edited Oct 11, 2017 at 20:10 Sean the Bean 5,3825 gold badges39 silver badges40 bronze badges answered Aug 21, 2014 at 9:42 SanchisesSanchises 8634 silver badges24 bronze badges Add a comment |Your Answer
Reminder: Answers generated by artificial intelligence tools are not allowed on Stack Overflow. Learn more
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Draft saved Draft discardedSign up or log in
Sign up using Google Sign up using Email and Password SubmitPost as a guest
Name EmailRequired, but never shown
Post Your Answer DiscardBy clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Not the answer you're looking for? Browse other questions tagged
or ask your own question.- The Overflow Blog
- We'll Be In Touch - A New Podcast From Stack Overflow!
- The app that fights for your data privacy rights
- Featured on Meta
- More network sites to see advertising test
- We’re (finally!) going to the cloud!
- Call for testers for an early access release of a Stack Overflow extension...
Linked
433 Tooltips for Button elements 1 Use of alt in button tagRelated
17 Is alt="" appropriate in some situations for html img tag? 0 Simple HTML "ALT" Tag Question. Please Help! 0 Why isn't alt a valid attribute for <input>? 0 Does HTML attribute 'alt' work with numbers? 0 How to use ALT tag correctly? 0 How do I use the alt attribute tag 4 Can an alt attribute be set using CSS? 0 Accessing a button's alt text using jQuery 11 Is alt the same as alt=""? 0 Can there be more than one alt attribute on an image?Hot Network Questions
- What are rests in the realm of rhythm and melody?
- Is it legal to take advantage of loopholes in GAAP to misrepresent profit?
- Why aren't there square astronomical units or square light years?
- How did the Dutch Republic get sufficient timber to build its navies?
- Is it allowed to use web APIs exposed in open-source code?
- Counting points on line in QGIS
- How quickly could a probe reach the heliopause?
- What is the correct article before a letter sound?
- Could air traffic control radars pick up a large stationary floating object?
- Continuum-distanced complete, ultrametric space
- A linked list in C, as generic and modular as possible, for my personal util library
- Which is larger? 999,999! or 2^(11!)
- Is it a bad idea to talk about the city/country in phd application letters?
- Was it really possible to damage my VGA card by programming it in assembly through its latches registers?
- Fantasy movie including magical mirror and evil wizard
- Using a platinum loop to light a gas stove in Oliver Sacks's memoir
- Adding wireless switch to existing 3-way wired system
- Printing clist out, but controlling whether there should be a \nobreakspace after “and”
- Are there any existing (indigenous) European languages with aspirated/unaspirated versions of consonants which are different phonemes?
- When SG-1 arrives in 1969, why is it initially an "empty" gate room?
- Can the Attorney General, with a cooperating president, naturalize all undocumented immigrants?
- How were lead sheets made in the Graeco-Roman world?
- FindInstance and Integers option
- Best way to design a PCB for frequent component switching?
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
lang-htmlTừ khóa » Html Button Alt Text
-
HTML Input Alt Attribute - W3Schools
-
HTML Alt Attribute - W3Schools
-
Image Buttons Must Have Alternate Text Axe Rules - Deque University
-
H36: Using Alt Attributes On Images Used As Submit Buttons - W3C
-
Image ALT Tag Tips For HTML - Accessibility At Penn State
-
HTML Input Alt Attribute - Dofactory
-
Alt Text: Why It's Important For Accessibility & SEO - Moz
-
HTML Tag With The 'alt' Attribute
-
A Guide: The Right Way To Write Alt Text - Clique Studios
-
Alternative Text: Web Content - Accessibility - Indiana University
-
t - Web APIs | MDN
-
- HTML: HyperText Markup Language | MDN"> - HTML: HyperText Markup Language | MDN
-
Alternative Text - IT Accessibility - NC State University
-
HTML Img Alt Tags For SEO Best Practice - Search Engines Love ...