I have a form generated by <% Ajax.BeginForm() {} %> which contains a lot of inputs and texareas.
When an input value change, I need to know about it
You could use jquery plugin dirrty for identifying form dirty.
https://github.com/rubentd/dirrty
In on("dirty") event set some global variable to true to identify form has changed.
Handle window.onbeforeunload or $(window).unload() event and get confirmation from user based on that variable value.
The advantage of this plugin is you can track back if form is changed to original values again using 'on("clean") event