content_type_extras.cancel_button.js 391 B

123456789101112
  1. (function ($) {
  2. Drupal.behaviors.content_type_extras_cancel_button = {
  3. attach: function(context, settings) {
  4. $('form.node-form #edit-cancel, form.node-form #edit-cancel--2').click(function() {
  5. var answer = confirm(Drupal.t('Are you sure you want to cancel and lose all changes?'));
  6. if (answer) {
  7. history.go(-1);
  8. }
  9. });
  10. }
  11. }
  12. })(jQuery);