jQuery动态移除和绑定事件
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 += '可参考:http://www.w3school.com.cn/jquery/event_unbind.asp