Can i prevent blur event from happening?

后端 未结 4 1404
我在风中等你
我在风中等你 2021-01-08 01:25

I have a simple example where i have an input field and i put a blur and change event on it:

HTML

<         


        
4条回答
  •  不知归路
    2021-01-08 02:03

    use .off

    DEMO

    $('input').change(function(e){
      alert('change'); 
      e.stopImmediatePropagation();
      $(this).off("blur"); //$("input[name='test']").off("blur");
    });
    
    $('input').blur(function(e){  
      e.preventDefault();
     alert('blur'); 
    });​
    

提交回复
热议问题