Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8044809
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T05:20:42+00:00 2026-06-05T05:20:42+00:00

I understand from other posts that the only way to handle this is through

  • 0

I understand from other posts that the only way to handle this is through a browser dialogue box that can’t be edited. What I am having a problem with is that box appearers no matter how I leave the page. The page has a save and delete button that are the correct ways to leave the page and I don’t want the dialogue box to appear for them.

Here is the JQuery I have

$(document).ready(function(){
//save or delete
  window.onbeforeunload = function() {
              var message = 'You have unsaved changes, please stay and save or delete them.';
              return message;
          }
}); 

and the save and delete button are:

  <a id='savenewscopesheet' class='taskbutton'>Save</a>
  <a id='deletenewscopesheet' class='taskbutton'>Delete</a>

I am using more JQuery to handle their function hence they don’t have an href.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T05:20:44+00:00Added an answer on June 5, 2026 at 5:20 am

    Updated the code

    $(document).ready(function(){
    //save or delete
    
    $('.taskbutton').click(function() {
    
        window.onbeforeunload = null;
    
        window.location='yourUrl'; //navigate to required page..
    
    });
    
    window.onbeforeunload = function() {
                  var message = 'You have unsaved changes, please stay and save or delete them.';
                  return message;
              }    
    
    
    
    }); 
    

    Try this..

    http://jsfiddle.net/kabichill/px4ZU/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I ran into a weird behavior from Oracle this morning... And I can't understand
I found that Maven implies specific directory layout. But I don't understand from here:
i don't understand this example from the doc : the timeIntervalSinceNow method should show
Can someone please explain how to understand a logcat from an android force close.
From what I understand PRNG uses a seed that generates a sequence of numbers
From what I understand, using Wiki and this question I posted, Microsoft has its
I've seen posts on SO and through google stating that with Mysql you cannot
I've found many other posts here on how to do this but unsure how
Is there a way to get the comments from buzz right now? I understand
I have read other posts and I really don't understand what I am doing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.