我有一个在桌面浏览器上完美运行的jQuery代码;

$("span#checkbox_err").mouseout(function () {
                        $("span#checkbox_err").fadeOut("slow");
                    });

但是,这不会在iPad上触发(因此,checkbox_err显示在屏幕上,但是从不隐藏)

如何在iPad上触发mouseout事件?

另外,我也想避免使用任何其他库来解决这个小问题。

我有一个后续问题

我正在iPad上测试页面,并且在实现等效于mouseout行为时遇到一些问题。

因此,这个问题很容易理解; 1.在我的页面上,单击(或触摸)复选框,我想显示一个errorMsg。2.单击/触摸除errorMsg以外的任何内容,我想隐藏errorMsg

下面是我编写的代码;
$(document).bind("touchstart",function(e){
         if(e.target.id != "checkbox_err")
        $("span#checkbox_err").fadeOut("slow");
     });
}


$("input:checkbox").bind("touchstart",function(){
$("span#checkbox_err").fadeIn("fast");

});

现在的问题是,当我单击/触摸复选框时,errorMsg会显示一段时间,然后也会立即将其隐藏(因为目标不是errorMsg)

如何解决此问题?

最佳答案

您可以尝试使用.blur()而不是.mouseout()

关于javascript - iPad上的jQuery mouseout,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/6994160/

10-09 09:44