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,2794 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.- Featured on Meta
- We’re (finally!) going to the cloud!
- More network sites to see advertising test [updated with phase 2]
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
- Have you it there?
- How do I hover in the Tails mech?
- The usage of Select for list (deep level)
- Bode diagram of rauch filter
- How to change the size of the text under min and arg min commands?
- What are Christian responses to Carlo Alvaro's argument against Christian theism?
- A fantasy movie with two races, "Big Ones" (=us) and smaller ones, about saving a newborn baby from a cruel queen
- Are garbage-collection programming languages inherently unsafe for use in cryptography
- Outlet Wiring Gone Wrong
- How can I insulate a cramped crawl space?
- Who is the "Sea-queen" mentioned in "Oedipus", and why is she referenced?
- What is the command to clear an entire line in Linux using Super + Backspace, like on Mac with Command (hold) + Backspace (tap)?
- Why motion of gas never stops?
- Isomorphic Free Groups Have Bijective Sets Using Category Theory
- How do I report to Springer a scientific fraud to a cryptographic paper published in Springer?
- Do additionally installed drivers survive Windows 11 "Reset this PC"?
- In AES GCM, would using different nonces that are close reveal data?
- How to make seal on lever flip-top "Kilner" jars without spoiling sterilization?
- Are there any tests for knowing whether a topological space admits a CW structure?
- Can Trump reverse President Joe Biden's pardon for his son?
- Use debs from the ubutu pro subscription to the unsubscribed machine
- Series about people who get infected with worms
- Are my basic implemetations of AES-CBC and AES-GCM in PHP secure?
- Pros & cons of Sallen-Key vs. double RC cascaded stages low pass filter topologies
To subscribe to this RSS feed, copy and paste this URL into your RSS reader.
lang-htmlTừ khóa » Html Alt Text For Buttons
-
HTML Input Alt Attribute - W3Schools
-
Image Buttons Must Have Alternate Text Axe Rules - Deque University
-
H36: Using Alt Attributes On Images Used As Submit Buttons - W3C
-
H36: Using Alt Attributes On Images Used As Submit Buttons
-
A Guide: The Right Way To Write Alt Text - Clique Studios
-
Image ALT Tag Tips For HTML - Accessibility At Penn State
-
Writing Alt Text For Accessibility: Guidelines And Examples
-
Just Need To Clarify, Alt Text On Buttons Is The Name Of The Button?
-
Alt Text: Why It's Important For Accessibility & SEO - Moz
-
Working With ALT Tags
-
Input-image-alt - Accessibility Insights
-
How To Write Good Alt Text | Nomensa
-
t - Web APIs | MDN
-
Alternative Text - IT Accessibility - NC State University