我有这个代码:
function beforemouseout() {
if ($(this).val() == '') {
$(this).val($(this).attr('title'));
}
else {
}
setTimeout('beforemouseout()',3000);
}
$(".other").click(function() {
$(this).val('');
$(".other").mouseout(beforemouseout);
});
<input id="hour" type="text" class="other" autocomplete="off" value="hour" title="hour" />
<input id="hour" type="text" class="other" autocomplete="off" value="minutes" title="minutes" />
但是 Firebug 给了我一个错误: beforemouseout 没有定义。为什么?我在 jsfiddle.net 上尝试过它并没有给出错误,但结果不是我所期望的。当我点击 #hour 隐藏文本以及触发 onmouseout 等待 5 秒然后 - 时,我期望做检查