Detect changes to any HTML form in JavaScript

This page demonstrates FormChanges(string FormID | DOMelement FormNode), a generic, standalone JavaScript function which detects when the user has made any updates to a form. It returns an array of changed elements – an empty array indicates that no changes have been made. NULL is returned if the form does not exist.

The code works in most browsers and has been tested in IE6, IE7, IE8, Firefox 3.6, Chrome 8, Safari 5 and Opera 11.

Your profile

newsletter format:

Click this link to discover which elements have been changed: detect form changes…

A "not saved" warning is displayed if you update the form but leave the page: visit the article describing this code…

For more information:

Disclaimer

The code was developed by Craig Buckler of OptimalWorks.net for SitePoint.com.

This code can be used without any restrictions but please don't expect 24/7 support! A link back to SitePoint.com is appreciated.