Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

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);
Comment

onsubmit in 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>

Comment

PREVIOUS NEXT
Code Example
Javascript :: random string from array javascript 
Javascript :: array.find is not a function 
Javascript :: Javascript how to compare three numbers 
Javascript :: cypress input value should be 
Javascript :: install nodemon 
Javascript :: angular for loop 
Javascript :: getitem localstorage 
Javascript :: generate random id javascript 
Javascript :: enter only numbers in input field angular 
Javascript :: javascript conver time into 24 hour format 
Javascript :: javascript remove item onclick 
Javascript :: today date javascript 
Javascript :: email id domain check javascript 
Javascript :: express-ejs-layouts install 
Javascript :: angular mat datepicker timezone 
Javascript :: create svg element javascript 
Javascript :: react router go rprevious page 
Javascript :: json foreach in javascript 
Javascript :: js remove seconds from time 
Javascript :: react use same useState for multiple inputs 
Javascript :: javascript iterate over divs 
Javascript :: checkvalidity 
Javascript :: getting days difference with moment js 
Javascript :: vue v-on:click 
Javascript :: get text from selected select javascript object 
Javascript :: windows how to set process.env variables 
Javascript :: the path argument must be of type string. received undefined react 
Javascript :: next js material ui typescript 
Javascript :: package json scripts multiple commands 
Javascript :: how to get specific word from the string javascript 
ADD CONTENT
Topic
Content
Source link
Name
1+2 =