Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

react beforeunload

window.addEventListener('beforeunload', (event) => {
  event.returnValue = `Are you sure you want to leave?`;
});
Comment

react beforeunload

let formChanged = false;
myForm.addEventListener('change', () => formChanged = true);
window.addEventListener('beforeunload', (event) => {
  if (formChanged) {
    event.returnValue = 'You have unfinished changes!';
  }
});
Comment

PREVIOUS NEXT
Code Example
Javascript :: react native transform 
Javascript :: form append other data feild and send through ajax 
Javascript :: html canvas draw base64 image 
Javascript :: select random from an array 
Javascript :: scroll to bottom of div javascript 
Javascript :: how to write img jsx 
Javascript :: filter array of objects to remove duplicate keys 
Javascript :: regex match entire words only js 
Javascript :: check if not checked vanila js 
Javascript :: js date after 1 year 
Javascript :: javascript scroll event 
Javascript :: react native apk build 
Javascript :: pad js 
Javascript :: how to extract year from utc in javascript 
Javascript :: Vanilla JS (on)load with page 
Javascript :: javascript substring after character 
Javascript :: how to get xhr response in javascript 
Javascript :: node js split data 
Javascript :: js first letter capital 
Javascript :: jquery selected option value 
Javascript :: javascript un hiden element 
Javascript :: sum javascript 
Javascript :: javascript loop through array of objects 
Javascript :: javascript regex extract url from string 
Javascript :: Update nextjs to 11 
Javascript :: change padding javascript 
Javascript :: how to get a channelid discord.js 
Javascript :: angular cli create component with module 
Javascript :: remove console log in production react 
Javascript :: import bootstrap css and js file in react 
ADD CONTENT
Topic
Content
Source link
Name
4+8 =