I'm trying to add onclick
to a button
in a form with action.
it's a mailchimp action for subscription, so after he click on the button will go to the success page of mailchimp in a new tab, but want also in the page to show a popup alert/div with a message, is it possible to have both? action and onclick for the same submit button?
any ideas how to make this?
UPDATE
My form look like this:
<form action="/" method="post" name="form" target="_blank">
<h3><span>Subscribe to Newsletter</span></h3>
<p class="email_first">
<label for="email">Your Email</label>
<input id="EMAIL" class="email" type="email" name="EMAIL" value="Your Email Address:" size="30" />
</p>
<p class="submit"><button type="submit">Send</button></p>
</form>
JavaScript
function popUp(){
var popup = document.createElement('div');
popup.className = 'popup';
popup.id = 'test';
var cancel = document.createElement('div');
cancel.className = 'cancel';
cancel.innerHTML = 'close';
cancel.onclick = function (e) { popup.parentNode.removeChild(popup) };
var message = document.createElement('span');
message.innerHTML = "This is a test message";
popup.appendChild(message);
popup.appendChild(cancel);
document.body.appendChild(popup);
}