Skip to content

Instantly share code, notes, and snippets.

@zy108830
Last active March 27, 2016 15:47
Show Gist options
  • Save zy108830/5bdf75393194486c496f to your computer and use it in GitHub Desktop.
Save zy108830/5bdf75393194486c496f to your computer and use it in GitHub Desktop.
jquery对象的click事件绑定一个有名称的外部函数
var editorHandler=function(){
//$(this)即$('#wenjuan_remark').
var $this=$(this);
$('#trigger-modal').trigger('click');
$('#modal-editor').find('.action-calcel').click(function(){
$('#modal-editor').find('.close').trigger('click');
});
$('#modal-editor').find('.action-ok').click(function(){
$this.html(wenjuan_remark.$txt.html());
$('#modal-editor').find('.close').trigger('click');
});
};
$('#wenjuan_remark').click(editorHandler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment