Input Fires Keypress Event Twice

后端 未结 8 2211
小蘑菇
小蘑菇 2021-02-18 14:26

This question has been asked/answered (mostly) before, BUT I\'ve tried three things to stop the event from bubbling but nothing has worked:

return false;
e.stopPr         


        
8条回答
  •  遥遥无期
    2021-02-18 14:47

    This is a problem which always drives me insane but i think this is the solution simply return false, if you return true it repeats it self randomly so im guessing it must have a listener which listens out for true responses.

    Short Answer Add return false;

    $("#register-form #first_name").keyup(function(event) {
    console.log('hello world');
    return false;
    

    });

    in the original question if you look at the code closely is seems the return false was written one line too early.

提交回复
热议问题