0

Consider:

<a href="#" onClick="myFunction22()"><img src="images/icon-exit.png" width="34" height="34" alt="Exit Fullscreen"></a>

I want a hover ALT tag for this Onclick link saying... "Exit Fullscreen"

Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
timbukto
  • 1
  • 2
  • use mouseover & mouseout js events to detect hover on your element and then grab the alt text from the img element and then create a element that acts like a tooltip – brados Jul 22 '23 at 07:48
  • Could you explain why the anchor tag is used here? I’m finding it confusing. – A Haworth Jul 22 '23 at 09:26
  • Does this answer your question? [Is there an equivalent to the "alt" attribute for div elements?](https://stackoverflow.com/questions/38380115/is-there-an-equivalent-to-the-alt-attribute-for-div-elements) – VincentDR Jul 26 '23 at 08:38
  • Are you able to alter the HTML? – A Haworth Jul 26 '23 at 12:26

3 Answers3

3

You can use the title attribute for this:

<a href="#" onClick="myFunction22()" title="Exit FullScreen"><img src="images/icon-exit.png" width="34" height="34" alt="Exit Fullscreen"></a>
Peter Mortensen
  • 30,738
  • 21
  • 105
  • 131
Thug Life
  • 87
  • 10
1

You can use the title attribute of the a tag like this:

  <a title="hello" href='/'>
    Hello world
  </a>
Sadeed_pv
  • 513
  • 1
  • 9
  • 22
1

You could do this without involving a link

<img src="images/icon-exit.png" onclick="myFunction22()" width="34" height="34" title="Exit Fullscreen">

but in either case, just use title=