button click event required an extra logic gate

pull/4/head
joates 10 years ago
parent 6b27d611fa
commit 633cf0b69a

@ -15,15 +15,17 @@ process.nextTick(function() {
document document
.getElementById("signup-form") .getElementById("signup-form")
.addEventListener("click", function() { .addEventListener("click", function(e) {
if (input_email && input_email.value) { if (e.srcElement.nodeName === 'BUTTON') {
var is_valid = check_email(input_email.value) if (input_email && input_email.value) {
if (is_valid) { var is_valid = check_email(input_email.value)
alert('got it, thanks '+ input_email.value) if (is_valid) {
form.submit() alert('got it, thanks '+ input_email.value)
} else { form.submit()
input_email.value = '' } else {
alert("that doesn't look like an email address, please try again...") input_email.value = ''
alert("that doesn't look like an email address,\nplease try again...")
}
} }
} }
}) })

Loading…
Cancel
Save