Error :85 Uncaught TypeError: Failed to execute 'addEventListener' on 'EventTarget': parameter 2 is not of type 'Object'.
code:
username.addEventListener('focusout', Exist(existed_username) );
can we pass argument like above?
CodePudding user response:
Try to do like this.
username.addEventListener('focusout', ()=>Exist(existed_username) );
CodePudding user response:
Yes you can, but not like that. You're basically executing the function right away, which should only occur upon firing that event. Instead, you can do:
username.addEventListener('focusout', Exist.bind(username, existed_username));