Answer the question
In order to leave comments, you need to log in
How to solve the issue of triggering $('').submit(); outside form in firefox?
I have two forms, fill in the email data in the first form and submit it via click, in the second form the submit doesn't fire only in firefox browser, are there any solutions?
<form id="first">
<input id="email" name="email" type="email" required="required">
<button id="sendbtn" type="submit">sumbit</button>
</form>
<form id="subscribe">
<input type="email" required="required" name="email">
<input type="submit" value="subscribe">
</form>
$('#sendbtn').click(function() {
var email = $('#first input#email').val();
$('#subscribe input[type="email"]').val(email);
$('#subscribe input[type="submit"]').submit();
});
Answer the question
In order to leave comments, you need to log in
You don't stop the first form from being submitted. Submitting a form by default is a page reload. Accordingly, since when you click on the first submit, you send the second, both forms will try to send, but either the first or the second will be sent, as you're lucky. Because at one time you can reload the page, obviously, only once. After a reboot, all scripts and actions are reset.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question