0

是否有一种使用 Javascript 的方式在输入框上添加帮助气泡?

例如,当您将鼠标悬停在 Name: _ ____的输入上时,它会显示为 First Name????

谢谢

一个例子是这个https://edit.europe.yahoo.com/registration?.intl=uk

当您浏览名称字段时,它会显示气泡中的名字

4

2 回答 2

4

你的意思是title属性吗?

<input type="text" title="First Name" />
于 2013-01-31T22:24:03.390 回答
0

As said in another answer you can add a title attribute to a html tag to have a tool tip display.

Or if you are after the behaviour where information is displayed somewhere on the page telling you about the text box you have selected you can; dynamically add to a div using document.createElement() and appendChild() when you hover over the element and removing it with removeChild() upon moving your mouse away or change the innerHTML of the html tag on those two events.

Edit: Unfortunately because I am a 'new' user I can't include all the hyperlinks to each part of the mozilla developer site, but simply search for those functions there for more explnation.

于 2013-01-31T22:39:57.660 回答