“JavaScript onSubmit” Respostas de código

JavaScript onSubmit

// get the form object
let object = document.getElementById('object')

// directly
object.onsubmit = function() { myScript };

// or using the addEventListener() method:
object.addEventListener("submit", myScript);
lff

OnSubmit em JS

//This is the best way to use onsubmit in js

// ----------------JS
register_form = document.getElementById('register_form');

register_form.onsubmit = function(){
  console.log(register_form);
  console.log(register_form.email);
  console.log(register_form.password);
  return false;
};


// ----------------HTML
<form id="register_form">
    <div class="">
        <input required type="text" name="email" placeholder="Email Address">                        
    </div>
    <div class="">
        <input required type="password" name="password" placeholder="Password">
    </div>
</form>

Dan George

Respostas semelhantes a “JavaScript onSubmit”

Perguntas semelhantes a “JavaScript onSubmit”

Mais respostas relacionadas para “JavaScript onSubmit” em JavaScript

Procure respostas de código populares por idioma

Procurar outros idiomas de código