首页 > 解决方案 > 输入元素自身内容的工具提示

问题描述

我希望当用户将鼠标悬停在输入字段上方时,工具提示将是输入内容,例如,如果我有

<input>hello world</input>

我希望当用户将鼠标悬停在此输入上方时,他会看到它的内容,我怎样才能通过 html/css/js/jquery

标签: javascripthtmljquerycss

解决方案


比方说,你有input

<input type="text" onmouseover="showThis(this);">

功能内容应为:

function showThis(me) {
    me.setAttribute('title', me.value);
}

推荐阅读