简体   繁体   English

onClick Jquery Ajax无法在手机上使用?

[英]onClick Jquery Ajax not working on mobile phone?

On my web site, I have a input button with an onClick event. 在我的网站上,我有一个带有onClick事件的输入按钮。 The onClick event simply triggers a javascript function. onClick事件仅触发javascript函数。 The function uses jQuery to do an Ajax Get call, and refreshes the web page as well. 该函数使用jQuery进行Ajax Get调用,并刷新网页。

It works fine on IE, Chrome(on my PC). 它可以在IE,Chrome(在我的PC上)上正常运行。 but on my cell phone, it does not work. 但是在我的手机上,它不起作用。 Bought the cell phone this year, so it is up to date in regards to browsing capabilities I would assume. 今年买了手机,所以我认为它是最新的浏览功能。 Using android as OS. 使用android作为操作系统。

try using tap with on in JS instead of onclick in your HTML tag. 尝试在JS中使用tap with on代替HTML标签中的onclick I had a problem similar to this and it was solved by using this instead : 我有一个与此类似的问题,而是通过使用以下方法解决了:

$("#mypage1").on("click tap vclick", "a", function (e) {
    e.preventDefault(); //dont forget this if you're using an anchor tag as a button 
    //your code.
});

Info abt vclick from the docs : 来自文档的信息abt vclick

The jQuery Mobile "vclick" event handler simulates the "onclick" event handler on mobile devices. jQuery Mobile“ vclick”事件处理程序在移动设备上模拟“ onclick”事件处理程序。

Info abt tap from docs : 信息ABT tap文档

Triggered after a quick, complete touch event. 在快速,完整的触摸事件后触发。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM