Input Fires Keypress Event Twice

后端 未结 8 2372
小蘑菇
小蘑菇 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:46

    Try changing all the instances of

    $(field).functionCall() 
    

    to

    field.functionCall() 
    

    since field is already a jQuery object.

    Ok now we've established that this wasn't the error. I tested in Firefox 7 and Chrome 15 and saw that the code block in the if statement is only fired once when enter is pressed. Try checking to make sure that something inside the createTag() function isn't doing something twice.

提交回复
热议问题