Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

prevent form from reloading with preventDefault

document.getElementById("defaultsub").addEventListener("click", function(event){
    if(document.querySelector('form').checkValidity()){
     event.preventDefault();
     console.log("Prevent default submission");
     alert("ALERT!!!!!");
}
})
Comment

PREVIOUS NEXT
Code Example
Javascript :: current year javascript 
Javascript :: jquery find child of parent sibling 
Javascript :: how to check if the user is in a certain guild in discord 
Javascript :: Ready check failed: NOAUTH Authentication required. 
Javascript :: fs move file 
Javascript :: react redux actions must be plain objects 
Javascript :: javascript create uuid 
Javascript :: page reload button using angular 
Javascript :: defer parsing of javascript wordpress 
Javascript :: jquery trigger link click 
Javascript :: how to creat a function 
Javascript :: how to access child img src in jquery 
Javascript :: javascript array value dom 
Javascript :: redirect react js 
Javascript :: redirect to html page in javascript 
Javascript :: select first 3 letters js 
Javascript :: javascript open in new window not tab 
Javascript :: javascript download string as file 
Javascript :: if statement es6 
Javascript :: Javascript prime number check 
Javascript :: form append other data feild and send through ajax 
Javascript :: fs.readdir example 
Javascript :: react redux wait for props 
Javascript :: express.json 
Javascript :: component did mount in hooks 
Javascript :: vuex v-model 
Javascript :: javascript on enter 
Javascript :: last position of array javascript 
Javascript :: how to get current date in js 
Javascript :: jquery datetimepicker example code 
ADD CONTENT
Topic
Content
Source link
Name
8+5 =