2016-12-27 84 views
1

我想点击一个按钮删除引导转盘和转盘显示所有列表如何删除引导传送带

这是之前的样子: enter image description here

后,我执行该代码:

$('#carousel-on-22').removeAttr('data-ride'); 
    $('#carousel-on-22').children().removeAttr('role'); 
    $('#carousel-on-22').children().removeAttr('class'); 
    $('#carousel-on-22').removeAttr('class'); 
    $('#carousel-on-22').children().children().each(function() { 
     $(this).removeClass('carousel-item'); 
     $(this).removeClass('active'); 
    }); 

这是它以后怎么看; enter image description here

引导传送带事件的所有事件仍与其关联。 如何删除所有这些事件?

回答

4

您可以像这样删除事件click或任何其他相关的事件,此元素:

$("#carousel-on-22").unbind(); //Remove all events 
$("#carousel-on-22").unbind('click'); //Remove `click` event only 
+0

工作的感谢! – codenut