My small JavaScript script is supposed to change the button text from "Subscribe" to "Close" after someone signs up for a newsletter. However, the functionality does not work as expected and the modal box closes instead.
Check out an example page here.
This is how my JavaScript script looks:
<script>
let $input = document.getElementById('mc-embedded-subscribe')
$input.addEventListener('click', function (){
this.value= "close"
this.backgroundColor= "red"
})
</script>
What could I be missing here?
View the Codepen here.
// Scripts related to MailChimp form
// Inserted scripts go here
// CSS code specific to the MailChimp form
// Inserted CSS code goes here
<!DOCTYPE html>
<html lang="en">
<!-- HTML Structure for MailChimp Form -->