2014-07-16, 01:32
Tutorial: SCEditor confirmation message |
This script will ask you if you want to leave a page if your message is not finished and you already clicked X button by mistake.
--> Tutorials, tips and tricks <--
SCEditor confirmation message
SCEditor confirmation message
1º - Javascript:
Placement: In all pages
- Code:
[panda=js]
$(function () {
var submit_clicked = false;
$('input[type="Submit"]').click(function () {
submit_clicked = true;
});
window.onbeforeunload = function () {
var b1 = $("form[name='post'] input[type='submit'][name='prevent_modif']").length;
var b2 = $["sceditor"] && $('#text_editor_textarea').sceditor("instance").val();
if ((b1 || b2) && !submit_clicked) {
return "There is still an unsent message on this page. Are you sure you want to quit?";
}
}
});
2º - Preview:
© PunBB Design
If you have any questions related to this topic create a topic with the following title: SCEditor confirmation message |