Submit button is not working!

I want to show an alert pop-up ! when the user click the submit button …
but its not showing the alert :frowning:

There is a console in codepen (I think bottom right corner), see if you see any errors there

i didn’t understand !!

You’ve attached two event listeners:

form.addEventListener('submit', function(){
    button.addEventListener('submit', function(){
        if(User_input.value === '' && Pass_input.value === ''){
            alert('Fields are empty');

If you remove the button event listener, the alert will show up.


well thank you so much man!! it literally work 's … but I don’t understand … why it doesn’t apply on the button ??

You’ve nested your eventListeners inside each other, so what you’ve written is that “if someone submits the form, add an eventListener to my button”, not “if someone submits the form, check the input fields and show an alert”.