Display text on MouseOver for image in html

jseth picture jseth · Aug 24, 2012 · Viewed 488.3k times · Source

I would like to display text when the user mouseovers the image.

How can I do this in HTML/JS?

Answer

Farhad Jabiyev picture Farhad Jabiyev · Aug 24, 2012

You can use title attribute.

<img src="smiley.gif"  title="Smiley face"/>

You can change the source of image as you want.

And as @Gray commented:

You can also use the title on other things like <a ... anchors, <p>, <div>, <input>, etc. See: this