Android/Phonegap - onClick() 不工作
我正在使用 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 有效,但是这对我没有多大用处,因为我需要使用提示要求用户确认更改,如果不是,则什么都不做.但是,使用 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"); });
不确定您是否在使用 jQuery,但希望这会有所帮助.
Not sure if you're using jQuery at all, but hope this helps.