.on(“click”)在iOS上无法使用 [英] .on("click") does not work on iOS

查看:217
本文介绍了.on(“click”)在iOS上无法使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我注意到

  $(body)。on(click,#id,function事件){... 

在iOS上无效,

  $(#id)。on(click,function(event){... 
pre>

相同的网站,相同的jQuery(最新),相同的DOM。我不能使用后者,因为#id是动态添加的。

$

  $(document).on(click touchstart,#id,function(event){... 


I noticed that

$("body").on("click", "#id", function(event) {...

does not work on iOS while

$("#id").on("click", function(event) {...

works perfectly. Same site, same jQuery (latest), same DOM. I can't use the latter because #id is added dynamically.

Ideas?

解决方案

Try as follows once:

$(document).on("click touchstart", "#id", function(event) {...

这篇关于.on(“click”)在iOS上无法使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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