+13 votes
189 views
in Android by (11.9k points)

Problem event click () in some webkit browsers

1 Answer

+14 votes
by (201k points)
Hi everyone,
Today I was trying to display a web on my phone Android and I discovered that something was wrong. Interestingly not a .click () event JQuery running smoothly in all other browsers except Safari for Windows is fired.
After searching stackoverflow I have found the solution in this post:
You see, to ensure that the event goes well must assemble a bit .. but nothing terribly complicated:
 
# First create an event
var click_ev = document.createEvent("MouseEvent");
# initialize the event
click_ev.initEvent("click", true /* bubble */, true /* cancelable */);
# trigger the evevnt
document.getElementById("someElement").dispatchEvent(click_ev);

I hope you might help;)

 
Update: After further testing, if encapsulate the element that calls the click () inside the wrapper of JQuery, also works and is more simple:
 
$ ($ () 'Item.') Click ().;

 

Ask a Question
Welcome to WikiTechSolutions where you can ask questions and receive answers from other members of the community.

You can ask a question without registration.

Categories

...