Search code examples
javascriptaddeventlistener

while passing string array from eventlistener, it throws an error


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?


Solution

  • Try to do like this.

    username.addEventListener('focusout', ()=>Exist(existed_username) );