How do I get ALT attributes for a onClick link?

65 Views Asked by At

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"

3

There are 3 best solutions below

0
On

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>
0
On

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

  <a title="hello" href='/'>
    Hello world
  </a>
0
On

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=