问题
See this sample in android 2.x browser..its a sample to replicate a scenario in my application..
http://johnchacko.net/samples/tap.html
Its about listening to 'tap' and calling changePage from listener...
The second page is having some input fields, 'tap' event is bubbling/propagating to second page and focus is randomly set to input fields...
I read similar issues and want to know anybody experienced same issue and got a workaround for it....
Or I must use only 'click' ?
回答1:
It can be fixed in few ways:
On tap/click event use this methods before you call changePage:
e.stopPropagation(); e.stopImmediatePropagation();
or:
$(document).on('tap', '#button', function(){ e.stopPropagation(); e.stopImmediatePropagation(); // Rest of the code });
Initialy disable all input boxes on a second page, on a pageshow event use settimeout function and enable them after cca 10 ms
来源:https://stackoverflow.com/questions/14624621/jquerymobile-tap-and-bubbling-propagation