How to remove $(document).on click event?

前端 未结 7 2049
孤独总比滥情好
孤独总比滥情好 2021-01-06 08:13

Here is the code to add event

   $(document).on({
      click: function() {
        $(this).hide();
        $(\'#form_name\').removeClass(\'hide\');
                 


        
7条回答
  •  难免孤独
    2021-01-06 09:08

    Try this:

    $('.form-template-name').unbind("click"", event);
    

    and define the click event as:

    var event = function() {
        $(this).hide();
        $('#form_name').removeClass('hide');
        $('#form_template_name')
          .attr('placeholder', $(this).text())
          .focus();
    };
    

    Then use it as you did before.

提交回复
热议问题