Here I have one web page like create. suddenly if i click on other tab need to show warining message like are sure want to leave
this is my code:
window.addEventListener("beforeunload", function (e) {
var confirmationMessage = 'It looks like you have been editing something.';
confirmationMessage += 'If you leave before saving, your changes will be lost.';
(e || window.event).returnValue = confirmationMessage;
return confirmationMessage;
});
But my problem if i fill all fields and submit button i got Popup message like you want to leave this page for above code. i Need to get warning message only if i click other page or other tab
Please help...
Thanks in advance

Shubham KumarRank #621 · 3.8K reputationPosted May 27, 2015, 9:30 AM EDT
Dipankar BiswasRank #992 · 2K reputationPosted May 27, 2015, 9:32 AM EDT