In this way, only with javascript.
The correct method is to use a button of type
<input type="submit">
, a
<button type="submit">
or a
<input type="image">
, the latter two have similar effect to submit, whereas
button
allows other nested elements (images included), and the second allows the sending by clicking on a specific image (by sending the coordinates clicked together).
If you still want a <a>
, follow the code. I do not recommend it as it affects the accessibility of the form.
<form method="post" action="" id="mail_form">
<div id="newsletter">
<input type="text" name="email_newsletter" />
<div class="newslink">
<input type="hidden" name="submit_newsletter" />
<a href="#" onClick="document.getElementById('mail_form').submit();">ENVIAR</a>
</div>
</div>
</form>
Remember that nowadays, using CSS, you can make the submit
conventional look like a regular link, with the advantage of not "breaking" the normal functionality of form
.
I would still have a gambiarra which is to use a <label for="botaodeenvio">
and hide the original button with position, opacity, etc, but it will still not be <a>
. Better to use CSS and conventional methods.