Android / Phonegap - onClick()不工作 [英] Android/ Phonegap - onClick() not working
问题描述
我使用phonegap并尝试检测onClick,但Android似乎完全忽略它,下面是我正在尝试:
I am using phonegap and am trying to detect the onClick, however Android seems to completely ignore it, below is what I am trying:
<select name="func" onclick="StartButtons();" data-native-menu="true">
我已经尝试过onClick包括javascript,jQuery等的几个变体,但是没有一个似乎工作。
I have tried several variations of the onClick include javascript, jQuery etc. however none of these seem to work.
我注意到onChange工作,但是这对我没有太多用处,因为我需要使用提示要求用户确认更改,如果它是没有什么也不做。
I have noticed that onChange works, however this is not of much use to me as I need to use a prompt asking the user to confirm the change, if it is no then do nothing. However, using onchange still changes the item within the dropdown.
有人可以帮忙吗?
推荐答案
我有与jQuery相同的问题,Android似乎忽略了javascript中的点击事件。最初,我的代码与jQuery看起来像这样:
I had the same problem with jQuery, Android seems to ignore the click event in javascript. Originally, my code with jQuery looks like this:
$("#element").click(function () { alert("message"); });
我必须将其更改为:
$("#element").on("touchend", function () { alert("message"); });
不知道你是否使用jQeury,但希望这有帮助。
Not sure if you're using jQeury at all, but hope this helps.
这篇关于Android / Phonegap - onClick()不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!