Within my web page, I have integrated a FormView that transitions to Edit mode when the user clicks the edit button. To enhance user experience, I have implemented a JavaScript onbeforeunload function that triggers a confirmation dialog if the user tries to navigate away from the page within the website. The dialog message states 'You are in Edit Mode. Leave this page?'. However, I am seeking a more refined approach where this confirmation message only appears if the user has made changes to any of the controls within the FormView. Given the numerous controls within the FormView, it seems excessive to prompt the user if no changes have been made.
My question is whether there is a way in JavaScript to detect if any control has been modified, or if I need to set up client-side event handlers for each TextBox, CheckBox, RadioButton, and DropDownList individually on the webpage.