how to unbind and bind again

前端 未结 5 1170
野性不改
野性不改 2021-01-23 00:59
$(\"#archive\").click(function(event){
        /*do something*/
});

$(\'#archive2\').unbind(\'click\',event);

i have this click function that I unbind

5条回答
  •  星月不相逢
    2021-01-23 01:20

    Try this:

    var closeHandle = function () {
          alert('close');        
    };
    
    function addClick() {       
             $("#btnTest").unbind('click').click(closeHandle);          
    }
    

提交回复
热议问题