MyBB Community Forums

Full Version: Warning when user leaving editor
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Is there a plugin that warns the user if something is written in editor and user tries to close or leave it?
Simple javascript if they attempt to close the page
$(window).unload(function() {
    var answer=confirm("Are you sure you want to leave?");
if(answer){
    //ajax call here
    }
});
Where should I add this? and does it apply to everywhere in forum ?
headerinclude