How could this be achieved via jQuery?
When the user clicks on any input in the form, it is focussed. When a user clicks out of the form from any input it is blurred
Here's the same basic idea as Alexey's but for jQuery 1.7+ and, at least to my mind, a little more readable because it keeps everything in scope within the same handler:
$("#myform").on("focusout focusin", "input", function(e){
if ( e.type == "focusout" ) {
$("#myform").attr("form-blur-timeout", window.setTimeout(function(){
console.log("you've left the form!");//do stuff here
}, 100));
} else {
window.clearTimeout($("#myform").attr("form-blur-timeout"));
}
});
Enjoy :)