ajax局部刷新后里面的jquery事件失效的解决方法
2016-01-09 15:58
736 查看
live()
与bind()作用基本一样。
最重要区别:live()可以将事件绑定到当前和将来的元素(eg:为id=zy元素绑定点击事件,而当你用js动态生成一个节点并插入到dom文档结构中时,如果你是用bind()绑定的,怎么新插入的节点将不会有该bind绑定事件。而live()则可以);
缺点: 无法用于链式结构。
eg: $('选择器').live('click',function(){ }) ; 正确写法 例如:$('#test').live('click',function(){ }) ;
$('.class').find('span').live('click',function(){ }) 错误写法 无效
live()绑定的事件可用 die()方法解除绑定。
以上引用自:http://www.cnblogs.com/zony/articles/jquery.html
using (Ajax.BeginForm("GetBasicInformation", "Employee", new AjaxOptions { UpdateTargetId = "basicInfo", LoadingElementId="loading", LoadingElementDuration = 3000, Url = Url.Action("GetBasicInformation"), HttpMethod = "Post" }, new { @class = "profileForm", id = "BasicInformation" }))
{
}
与bind()作用基本一样。
最重要区别:live()可以将事件绑定到当前和将来的元素(eg:为id=zy元素绑定点击事件,而当你用js动态生成一个节点并插入到dom文档结构中时,如果你是用bind()绑定的,怎么新插入的节点将不会有该bind绑定事件。而live()则可以);
缺点: 无法用于链式结构。
eg: $('选择器').live('click',function(){ }) ; 正确写法 例如:$('#test').live('click',function(){ }) ;
$('.class').find('span').live('click',function(){ }) 错误写法 无效
live()绑定的事件可用 die()方法解除绑定。
以上引用自:http://www.cnblogs.com/zony/articles/jquery.html
using (Ajax.BeginForm("GetBasicInformation", "Employee", new AjaxOptions { UpdateTargetId = "basicInfo", LoadingElementId="loading", LoadingElementDuration = 3000, Url = Url.Action("GetBasicInformation"), HttpMethod = "Post" }, new { @class = "profileForm", id = "BasicInformation" }))
{
}
相关文章推荐
- jquery页面刷新reload
- 异步加载数据 jQuery $.getJSON
- Jquery Ajax发送请求的方法
- jquery学习随笔(事件对象)
- oschina jQuery 插件
- oschina jQuery 插件
- 使用jqueryui
- jQuery: 做一个简单的模版加载
- jQuery立即调用表达式
- jquery源码分析——元素大小
- jQuery EasyUI combobox多选及赋值
- jQuery-iframe加载完成后触发的事件监听
- 基于jQuery的响应式Tab选项卡插件easyResponsiveTabs.js
- ajax和jquery使用技巧
- jquery 处理破图
- jQuery中serializeArray方法的使用及对象与字符串的转换
- jQuery页面刷新(局部、全部)问题分析
- jquery调整表格行tr上下顺序实例讲解
- 编写jQuery插件
- jquery学习随笔(基础事件)