- 1

How to show the name of object when we drag the mouse upon the obj. In html

it didnt work

18th Jul 2017, 1:24 PM
ranjit
ranjit - avatar
4 Answers
+ 4
Try to use the 'title' attribute for that (it's not the purpose of 'alt' attribute, which is mandatory...) https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/title
18th Jul 2017, 5:17 PM
visph
visph - avatar
+ 1
@Rajat Rawal: In addition to the fact that thread is about 6 month old now, and asker seems to not be active from about 3 month, the question was already correctly answered, without any JS requirement ^^ (check the link about 'title' attribute to convince yourself ;P) And anyway, using alert() inside a 'mouseover' event listener is a very bad idea... At most, use console.log() for debug purpose, or even any html element innerHTML content to display the information wanted, and hide it on 'mouseout' event...
7th Feb 2018, 1:09 AM
visph
visph - avatar
0
It needs javaScript. You can just write the following syntax : - <element onmouseover="myScript"> In your case, you can write -- <img onmouseover="alert("my car");" src="abc.jpg" alt="my car">
7th Feb 2018, 12:16 AM
Rajat Rawal
Rajat Rawal - avatar
- 1
alt="my
5th Feb 2018, 4:19 PM
Prince Rawal
Prince Rawal - avatar