My project is a single page site build using jquery and html.
In my project i have a lot of creation and updation forms and these are managed by showing and hiding divs,elements loading and removing of html's.
I want to add a functionality in my project that pops up a confirm box whenever a creation or updation page is left.
I mean when a user is creating something and he clicks on a menubar(purposefully or by mistake) then a confirm box should pop up saying
Are you sure you want exit ?
I tried
window.onbeforeunload
but it doent work for me.
now as the elements are getting loaded and removed dynamically and the page is not redirected hence i cannot use this method..
any suggestions ?