87,910
社区成员
发帖
与我相关
我的任务
分享
$.fn.Lister = function(){
var container = this;
// 获取一个列表
$.get('xxxx', function(result){
// 遍历列表,并创建到容器中
$(result).each(function(){
$(container).append('<button>'+ this.Name +'</button>');
});
});
}
$('#DivId').Lister();
$('#DivId').Lister('onClick' : function(buttonHtml){ alert(buttonHtml) });
$(container).append($('<button>'+ this.Name +'</button>').bind('click',function(){
//todo
}));