是否有一种使用 Javascript 的方式在输入框上添加帮助气泡?
例如,当您将鼠标悬停在 Name: _ ____的输入上时,它会显示为 First Name????
谢谢
一个例子是这个https://edit.europe.yahoo.com/registration?.intl=uk
当您浏览名称字段时,它会显示气泡中的名字
是否有一种使用 Javascript 的方式在输入框上添加帮助气泡?
例如,当您将鼠标悬停在 Name: _ ____的输入上时,它会显示为 First Name????
谢谢
一个例子是这个https://edit.europe.yahoo.com/registration?.intl=uk
当您浏览名称字段时,它会显示气泡中的名字
你的意思是title属性吗?
<input type="text" title="First Name" />
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.