An error has occurred

{{terminalError}}

Election news made simple

Get expert analysis on this unprecedented election in the NPR Politics newsletter.

Thank you!

You've been added to our mailing list. See you in your inbox!

See more subscription options
var emailForm = document.querySelector('#newsletter-form'); var userEmailInput = document.querySelector('.pn-ribbon__email'); var emailLabel = document.querySelector('.pn-ribbon__label'); var userSubmit = document.querySelector('#submit-button'); var userFakeSubmit = document.querySelector('#fake-button'); var checkEmail = function (inputData) { var regex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/; return regex.test(inputData); }; userEmailInput.addEventListener('input', function () { emailForm.classList.remove('pn-ribbon__input-wrapper--bad'); emailLabel.innerText = ''; if (checkEmail(userEmailInput.value)) { userFakeSubmit.hidden = true; userSubmit.hidden = false; } else { userSubmit.hidden = true; userFakeSubmit.hidden = false; } }); userFakeSubmit.addEventListener('click', function () { if (!checkEmail(userEmailInput.value)) { emailForm.classList.add('pn-ribbon__input-wrapper--bad'); userEmailInput.focus(); if (userEmailInput.value === '') { emailLabel.innerText = 'Please enter a valid email address'; } else { emailLabel.innerText = 'Please enter a valid email address'; } } else { emailForm.classList.remove('pn-ribbon__input-wrapper--bad'); emailLabel.innerText = ''; } }); // esc key closes modal document.onkeydown = function(event) { var event = event || window.event; if (event.keyCode == 27) { $('#remove-modal').click(); } }; window.addEventListener("message", function (e) { // We verify that the error message is coming from Piano, so it must be what we're looking for. if (typeof e.data.piano != 'undefined') { // Get the object with the result. var result = e.data.piano; if (!result.success) { // Append the text message into the block. $('#pn-ribbon__label').text(result.message); }else{ // Show success and allow close button $('.pn-ribbon__close').removeClass('ng-hide'); $('.pn-ribbon__form-wrapper').css('display', 'none'); $('.initial').css('display', 'none'); $('.success').css('display', 'block'); } } return; }, false);