jqtouch中标签不可点击

发布于 2024-10-01 21:52:14 字数 363 浏览 0 评论 0原文

使用以下代码,我无法单击 jqtouch 中的标签(在 iphone 模拟器和 iphone 本身上):

<ul class="rounded">
  <li>
    <label for="user_name">Name</label>
    <input type="text" name="user_name" id="user_name"/>
  </li>
</ul>

它在 safari 中运行良好,我也在 jquery-mobile 的演示中检查了这一点,并且它正在 iphone 模拟器上运行,所以问题接缝到严格是 jqtouch 特定的。

With following code I can not click on labels in jqtouch (on iphone simulator and iphone itself):

<ul class="rounded">
  <li>
    <label for="user_name">Name</label>
    <input type="text" name="user_name" id="user_name"/>
  </li>
</ul>

It is working well in safari, I have checked this also in demo of jquery-mobile and it is working on iphone simulator, so problem seams to be strictly jqtouch specific.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

长发绾君心 2024-10-08 21:52:14

为此,有一个晦涩的技巧,使用CSS:

label {cursor:pointer; 。

它可以在 iPhone 和 iPad 上运行

There is an obscure trick for this, using CSS:

label { cursor: pointer; }

And it will work on iPhone and iPad.

稚然 2024-10-08 21:52:14

将 onclick="" 添加到标签

<label for="blah" onclick="">blah</label>

add onclick="" to the label

<label for="blah" onclick="">blah</label>
分開簡單 2024-10-08 21:52:14

感谢@Ivan,我找到了更好的解决方案:

  $('label[for],input[type="radio"]').bind('click', function(e) {
    e.stopPropagation();
  });

此外它还修复了单选按钮。

唯一的缺点是 - 它会停止传播,但就我而言,这是可以的。

thanks to @Ivan I found better solution:

  $('label[for],input[type="radio"]').bind('click', function(e) {
    e.stopPropagation();
  });

Additionally it fixes radio buttons.

The only downside is - it stops propagation, but in my case it is ok.

不念旧人 2024-10-08 21:52:14

是的,user693942 CSS 技巧就足够了,实际上,它有效!

label { cursor: pointer; }

yeah, the user693942 CSS trick is enough, actually, it works!

label { cursor: pointer; }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文