现在的位置: 首页 > 综合 > 正文

解决jquery 新建的元素事件绑定问题

2018年04月06日 ⁄ 综合 ⁄ 共 400字 ⁄ 字号 评论关闭
//添加新元素事件后,重新绑定
//unbind();
//bind();
//解决jquery新建的元素事件绑定问题,实现rebind()功能
function bind(){
	$("a[name='columnSel']").bind("click",function(){
		$("#postfid").attr("value",$(this).text());
		$("input[name='typeid']").attr("value",$(this).attr('id'));
		//关闭窗口
		$("#windownbg").remove();
		$("#windown-box").fadeOut("fast",function(){
			$(this).remove();
		});
	});}
function unbind(){ 
	$("a[name='columnSel']").unbind("click");
}
bind();

抱歉!评论已关闭.