If I understand you correctly, the problem occurs when blur caused by a button click.
Fortunately, event information is passed to the handler, and the event must contain the target property. From this, you can conclude that there is something to do with blur . Use your favorite js debugger to stop in the blur event handler and see what is from the target property.
$("#displayname").blur(function(evt) { if (evt.target is not the button){ // figure this out with debugger //do something return true; // I handled it } return false; // I didn't handle it })
However, in this case, you will not perform your dynamic check that everything in the field is missing from the database.
@eZakto has a good suggestion to disable the submit button until an ajax check is done on your input.
source share