jquery mobile 事件绑定问题 已解决
来源:互联网 发布:网络借贷业务管理办法 编辑:程序博客网 时间:2024/05/14 06:31
<!DOCTYPE html><html><head> <meta http-equiv="content-type" charset="utf-8"> <link rel="stylesheet" href="../ui-desgin/css/jquery.mobile-1.1.2.css" /> <script src="../-desgin/scripts/jquery-1.7.2.js"></script> <script src="../ui-desgin/scripts/jquery.mobile-1.1.2.js"></script> <title></title> <style type="text/css"> .showfield{ } .touchfield{ } </style> <script type="text/javascript"> $(function(){ $(".showfield").hide(); $(".touchfield").unbind("click"); $(".touchfield").bind("click", function(){ var t = $(this).next(".showfield"); if(t.css("display")!="none") t.css("display","none"); else t.css("display",""); } ); }); </script></head><body> <div id="page" data-role="page" data-theme="b"> <div data-role="header"> <h3>测试页面</h3> </div> <div id="content" data-role="content"> <div class="touchfield"> <label for="test1">测试1</label> <input type="radio" id="test1"> </div> <div class="showfield">123</div> <div class="touchfield"> <label for="test2">测试2</label> <input type="radio" id="test2"> </div> <div class="showfield">456</div> </div> </div></body></html>这段代码 在pc上chrome 没问题但是到手机端 点就不好使了不会把 showfield显示出来但是 只要把 touchfield div里加几个字 或者把div撑大起来 点撑大的部分 就好使求解~~
大佬就是大佬 经验丰富不是盖的
在听我描述完这个问题后,大佬给出了3种解决方法 我用的是最后一种
采用代理模式,你不是.类无法触发吗? input能触发吧,ok ,触发input的onclick事件 在里面触发.类的 齐活……
代码修改为
$(".touchfield").find("input:radio").bind("click",function(){ var t = $(this).parent(".touchfield") if(t.css("display")!="none") t.css("display","none"); else t.css("display","")});
搞定……
- jquery mobile 事件绑定问题 已解决
- jquery mobile 事件 多次绑定
- jquery绑定事件问题
- 解决jquery 新建的元素事件绑定问题
- Mobile Safari 鼠标事件绑定问题
- jquery重复绑定事件问题
- jquery绑定事件注意问题
- jquery mobile中动态生成元素的事件绑定
- 解决jquery的多次绑定事件
- jQuery中重复绑定事件的解决
- Jquery前端之 事件绑定(二) 解决事件的删除,事件的无序执行的问题,有个小例子
- 解决linkbutton组件disable方法无法禁用jQuery绑定事件的问题
- 解决jQuery元素绑定toggle事件后元素变成隐藏的问题
- jQuery 插入元素时绑定事件 或 已加载的html绑定事件
- jquery 新建的元素事件绑定问题
- jquery 新建的元素事件绑定问题
- jquery 新建的元素事件绑定问题
- jquery 新建的元素事件绑定问题
- java加密枝术
- Android Contacts模块基本知识
- C# winform中无边框窗体的移动
- IOS Developer Library
- C++11新特性测试和使用(9个新特征)
- jquery mobile 事件绑定问题 已解决
- macbook 深度休眠和待机
- Java线程总结
- 已知二叉树前序遍历和中序遍历,求后续遍历
- Science杂志公布的机器学习资源
- 【字符串操作】11.查找一个字符串中最长的纯字母的子串(即查找最长的单词)
- 机器学习算法中文视频教程
- Linux 的启动流程
- PHP初级程序员能力测试参考答案