I have a form which contains a lot of elements. Whenever I change an element (for example, a textbox or a text area), and then I go to another page, the browser will display a confirmation message for me to confirm if I'm sure I want to exit.
Here is my simple form, not the real one:
<form action="/action_page.php">
<label for="fname">First name:</label><br>
<input type="text" id="fname" name="fname"><br>
<label for="lname">Last name:</label><br>
<input type="text" id="lname" name="lname"><br><br>
<input type="submit" value="Submit">
</form>
So, when I edit the FirstName or the LastName and go to leave the page, the confirmation message will appear. But when I delete all the changes and go to leave the page, the confirmation message won't appear anymore. And because I also use my form when I insert and edit, I cannot just simply compare between the input fname and "" (for example), but I need to compare the original data and the new data.