Android/Phonegap - onClick() 不工作 [英] Android/ Phonegap - onClick() not working

查看:32
本文介绍了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.

这篇关于Android/Phonegap - onClick() 不工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆