我从jQuery DataTable中解雇了多个click方法。 (我只想要一个)
//First set the table into a datatable
$("#mytable").datatable(/*in here I define the click*/);
//Then hide the first 2 columns for admin purposes
$("#mytable").fnSetColumnVis( 0, false );
$("#mytable").fnSetColumnVis( 1, false );
当我注释掉底部两行时,一切正常,但如果没有,点击功能会被调用3次。
答案 0 :(得分:0)
如果你正在使用$("")。点击(function(){});然后在某处您可以多次添加函数。有一个简单的方法来解决这个问题
$("").off('click').click(function(){});