如何在工具提示中获取输入文本字段的值,对于我来说,我正在使用带自动完成功能的文本框。每当我在自动完成中进行选择时,它将显示在文本框中。当我悬停在它上面时,我想要工具提示中的文本框中的值。有人可以帮我吗?
<input type="text" value="something" class="curate">
如何在工具提示中获取输入文本字段的值,对于我来说,我正在使用带自动完成功能的文本框。每当我在自动完成中进行选择时,它将显示在文本框中。当我悬停在它上面时,我想要工具提示中的文本框中的值。有人可以帮我吗?
<input type="text" value="something" class="curate">
$(document).ready(function(){
$('#testInput').keyup(function(){
$(this).attr('title',$(this).val())
})
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
Type Something
<input type="text" title="" value="" id="testInput">
function updateTitle(me)
{
me.title=me.value;
}
<input type="text" title="something" value="something" id="one" class="curate" onchange="updateTitle(this)">
$('input[type="text"],input[type="number"],input[type="date"]').hover(function() {
$(this).attr('title', $(this).val()); });
$('input.curate').on('change', function (){
this.title = this.value;
});
<input type="text" id="one" value="something" class="curate">
<script>
var x=document.getElementById("one");
x.title=x.value;
</script>
title
属性提供,还是由您使用的插件提供的? - David Thomas