> 'click .enable': function(e, value, row, index) {> var that = $(this);> > // console.log(row);> // console.log($(that).closest("tr").find(".stop"));> $(that).closest("tr").find(".stop").replaceWith('<span class="label label-success start">已啟用</span>');> $(that).replaceWith('<a class = "disable btn blue btn-xs blue-stripe" href="javascript:void(0)">停用</a>');> console.log($(that));> > > > },> 'click .disable': function(e, value, row, index) {> var that = $(this);> > $(that).closest("tr").find(".start").replaceWith('<span class="label label-primary stop">已停用</span>');> $(that).replaceWith('<a class = "enable btn green btn-xs green-stripe" href="javascript:void(0)">啟用</a>');> > }目前用了relaceWith方法替換所選擇的元素,但是事件也銷毀了,請問大家有什么好的辦法。
替換html元素,不解綁事件,應(yīng)該怎么做?
九州編程
2018-11-06 14:14:47