在我用.select()鼠标悬停在输入框中时选择文本后,我执行了以下操作:
HTML:
<input type="text" class="hoverAble" value="hover here"/><br />
Run Code Online (Sandbox Code Playgroud)
jQuery的:
$(".hoverAble").mouseenter(function() {
this.select();
}).mouseleave(function() {
//I can't figure what to put here.
});
Run Code Online (Sandbox Code Playgroud)
看到这里. 警告它正常运行(在jsfiddle中)你必须在结果框中单击一次.
主要思想是按预期mouseleave工作.
正如您可能已经注意到的那样,当您将鼠标悬停时我无法找到取消选择文本的方法并避免这种情况:
