JQuery mouseout on iPad

I have jQuery code that works fine on desktop browsers;

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

But the same does not work on the iPad (as a result, checkbox_err is displayed on the screen but never hidden)

How to trigger mouseout event on iPad?

I also want to avoid using an extra library to fix this little problem.

I have the following question

I am testing a page on an iPad and encounter some problems that implement the equivalent of mouse behavior.

So the question is very easy to understand; 1. On my page there is a check box in the click (or rather touch), I want to show errorMsg 2. By pressing / tap nothing but errorMsg, I want to hide errorMsg

Below is the code I wrote:

 $(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"); }); 

Now the problem is that when I click / touch this checkbox, errorMsg shows for a while and then it also hides it right away (since the target is not errorMsg)

How to fix this problem?

+7
source share
4 answers

You can try .blur () instead of .mouseout ()

+2
source

Maybe because of the bubble? It makes sense to me, the event will reach the bottom layer, which is not the goal. So you should stop eventPropagation:

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

Hope this helps you. Have you accidentally found an alternative for a mouse? - who brought me here.

+1
source

this example will definitely help you! http://jsfiddle.net/PzTcS/12/ , it works well on the iPad.

+1
source

You can try with the GestureEnd () event in ipad

-one
source

All Articles