function bindEvent() { //移除绑定事件 $('.btnsp').unbind('click'); //绑定事件 $('.btnsp').bind('click', function () { console.log('test'); }); } $(function () { $.ajax(url + 'api/WxHome/GetProduct', { dataType: 'json', type: 'get', success: function (data) { var html = ''; if (data.Success) { for (var i = 0; i < data.Module.length; i++) { html += '<li class="btnsp">' + data.Module[i].Name + '</li>'; } $('#content').html(html); } //动态绑定事件(等页面内容初始化完成后先解绑事件再次绑定事件) bindEvent(); }, error: function (xhr, type, errorThrown) { console.log("errer:" + errorThrown); } }); });