I am working on gathering the information from the user, once the document details been saved into database, still user can be able to edit the form data at any time. If user click "Back" button system will show the confirmation message on unsaved changes if user changes and not saved. I have lot of fields in the component like radio buttons, and input fields. Is there any generic method available in LWC to identify DOM changes ?

1 Answer 1


popstate event will do the trick like below:

window.addEventListener("popstate", () => {
  // your custom code

Try to do a search on google to know more about this event.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .