检测 jQuery Mobile 中的选择滑块更改事件
检测 jQuery Mobile 中选择滑块更改的可靠方法是什么?我尝试绑定一个处理程序来更改选择控件本身的事件,但它在初始页面显示时触发,然后在单击时触发多次,有时甚至在悬停时触发(在桌面浏览器中)。
此行为的最小工作示例发布在此处: http://jsfiddle.net/NPC42/mTjtt/3 /
这可能是由于 jQuery Mobile 添加更多元素来将选择样式设置为翻转开关所致,但我找不到推荐的方法。
非常感谢任何帮助。
What is a reliable way to detect change of a select slider in jQuery Mobile? I try to bind a handler to change event of the select control itself, but it fires on initial page display, and then fires multiple times on clicks, and sometimes even on hover (in desktop browser).
The minimal working example of this behaviour is posted here: http://jsfiddle.net/NPC42/mTjtt/3/
This is probably caused by jQuery Mobile adding more elements to style the select as the flip-toggle, but I can't find the recommended way to do it.
Any help is much appreciated.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
可能不是最巧妙的解决方案,但它确实有效
http://jsfiddle.net/mTjtt/4/
May not be the slickest solution but it works
http://jsfiddle.net/mTjtt/4/
实例:
JS:
HTML:
更新:
我在这里提出了 jQM 的问题/错误:
Live Example:
JS:
HTML:
UPDATE:
I have raised an issue/bug with jQM here:
使用此代码,
!不要将 type="range" 添加到您的输入标签中,而是将 type="text" 替换。
由于您是手动调用滑块函数。
Use this code,
!Do not put type="range" to your input tags , put type="text" instead.
Since you are calling slider function manually.