```javascript
function confirmExit(enabled) {
window.onbeforeunload = (enabled) ? onUnloadMessage : null;
}
function onUnloadMessage() {
return "You're about to leave without saving!";
}
// Enable
$('.input').change(function() {
confirmExit(true);
});
```