How to make a submit with button type="button"?

0

I have created some and I need them to perform the same functions (with database) as register, change, etc. Can someone help me or explain to me how I do this?

Thank you!

    
asked by anonymous 27.04.2017 / 20:21

1 answer

3

With javascript you can click the button to invoke the submit event of form:

HTML:

<form id="meu_form">
  <button id="enviar" type="button"> Enviar </button>
</form>

Javascript

document.getElementById('enviar').addEventListener('click', function() {
  document.getElementById('meu_form').submit();
});
    
27.04.2017 / 20:27