Use Submit Event Listener When Form Is Submitted Via Inline JavaScript?
We have a script that tracks form submits by adding an event listener to the form. The problem is that one customer submits the form via a link using );
form[0].addEventListener("submit", function(e) {
e.preventDefault();
alert('event');
});
form[0].childNodes[3].addEventListener("click", function(e) {
e.preventDefault();
alert('event');
});
Solution 2:
instead of using the href try this
<form method="post" name="formname" class="form">
<input type="text" name="hello">
<a onclick="javascript:document.formname.submit();">Submit</a>
<input type="submit">
</form>
remove the href
and replace it with onclick
Post a Comment for "Use Submit Event Listener When Form Is Submitted Via Inline JavaScript?"