简体   繁体   English

使用 Javascript 在 iOS 上触发 click() 之类的东西?

[英]Trigger something like click() on iOS using Javascript?

I'm developing an iOS-specific version of my site, and am looking for a way to trigger a <select> when the user taps a different image.我正在开发我的网站的 iOS 特定版本,并且正在寻找一种在用户点击不同图像时触发<select>的方法。 I'm using jQuery (and can use jQuery mobile), but am open to other options, as well.我正在使用 jQuery(并且可以使用 jQuery 移动设备),但也对其他选项持开放态度。 I'm stuck, and have trid triggering click(), touchStart(), and tap(), and no luck this far.我被卡住了,并且已经触发了 click()、touchStart() 和 tap(),但到目前为止还没有运气。

Does anybody know a relatively lightweight way to do this?有谁知道一种相对轻量级的方法来做到这一点? Again - just when the user taps an image, that activates a <select> , and thus shows the UIPickerView in iOS (I think that's what it's called).再次 - 就在用户点击图像时,它会激活<select> ,从而在 iOS 中显示 UIPickerView (我认为这就是它的名称)。

Thank you!谢谢!

According to quirksmode.com , iOS fires the click event on a tap.根据quirksmode.com , iOS 触发click事件。 So couldn't you use an event listener on the <img> (or whatever tag you're enclosing the image in) to activate the select ?那么您不能在<img> (或您包含图像的任何标签)上使用事件侦听器来激活select吗?

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

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