Reputation: 161
I'm using NicEdit in a form for my company's webpage.
Before using NicEdit, we just used a regular textarea input box. If we typed in any textarea boxes, before leaving the page we would get an "unsaved changes" prompt. Now I'm not longer receiving that prompt since changing to NicEdit. I wanted to see if there's a way to create a prompt specifically for the NicEdit textarea boxes.
Here's the coding for the prompt that is being used for the textarea boxes. Not sure if it's commonly used because the person that previously built this site was not very organized.
<script type="text/javascript">
var warnMessage = "";
$(document).ready(function() {
$(':input').change(function() {
window.onbeforeunload = function() {
if (warnMessage != null) return warnMessage;
}
});
$('input:submit').click(function(e) {
warnMessage = null;
});
});
</script>
Here is the NicEdit script info:
<script src="http://js.nicedit.com/nicEdit-latest.js" type="text/javascript"></script>
<script type="text/javascript">
bkLib.onDomLoaded(nicEditors.allTextAreas);
</script>
Upvotes: 0
Views: 201