I have an HTML form that I would like to make interact with some JavaScript:
...
Email:
...
I have some JavaScript that I want to take the entered email address and store it in an array (it is currently inline with my HTML hence the script tags):
var emailArray = [];
function signup(){
var email = document.signup.email.value;
emailArray.push(email);
alert('You have now stored your email address');
window.open('http://google.com');
console.log(emailArray[0]);
}
I was hoping that this simple script would store the email in emailArray but the console remains empty throughout the execution.
What is wrong with this code?