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

  • Home
  • SEARCH
  • 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 532991
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:27:45+00:00 2026-05-13T09:27:45+00:00

im trying to make a popup that comes up to confirm a users action

  • 0

im trying to make a popup that comes up to confirm a users action (deleting a row in a table, for example..). aiming at making the popup entirely HTML and Javascript. What i can’t get my head around is how i would make the javascript wait for the users input, but still function for other javascript events. (other click triggered stuff, etc..). What i thought i’d do is something like

if(makePopup("Are you sure?") == true) {
 //bla bla 
}

where makePopup function would create a popup containing the string passed to it, and give the user a yes or no option. somewhere in that function i’d need a loop that would wait for the user to click yes or no. the code just waits at that line until something is done. which is what i want… but theres my problem.. if the code is stuck in a loop there, how can jquery perform other tasks? for example, what if the popup box was draggable? how will the events for these effects get trigged when the code is busy looping at that point..? just cant get my head around a solution right now..

here’s something i have at the moment to test..

        $(document).ready(function(){
        $('a').click(function(){
            makePopup("Wana go to google?",function(){
                window.location.replace("http://www.google.com");
            });
        });
    });

    function makePopup(msg,callback){
        $('body').append("<div class='popup'><p>"+msg+"</p></div>");
    }

still unsure of how to do the confirmation stuff. the popup should include a yes and no button.

  • 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-05-13T09:27:45+00:00Added an answer on May 13, 2026 at 9:27 am

    you can implement something like this

    makePopup("Are you sure?", function {
      //bla bla 
    });
    

    which will call your callback only if user sure, after he clicks a button or whatever. Smth like:

    function makePopup(msg, callback) {
         $("#sureformmsg").html(msg);
         $("#sureform").show().submit(function() { if (..check..) callback(); });
    }
    

    Your example:

    $(document).ready(function(){
        $('a').click(function(){
            makePopup("Wana go to google?",function(){
                window.location.replace("http://www.google.com");
            });
        });
    });
    
    function makePopup(msg,callback){
        $('body').append("<div class='popup'><p id='themsg'>"+msg+"</p></div>");
        $('#themsg').onclick(callback);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make this jQuery filter that uses .find case-insensitive. For example, when the
I am trying to make a Login popup window. For example, if someone clicked
I'm trying to make a little JScript popup that displays information from the form
im trying to make a lightbox popup that triggers is the user has not
I'm trying to make a bubble that can popup when the onmouseover event is
I am trying to make a bookmarklet that opens a popup window. Inside this
Im trying to make a popup box that causes the surrounding area to get
I'm trying to make a draggable popup with Jquery and I'm following the advice
I'm trying make an entity with doctrine that has three associations with other entities
I was trying to make a popup php form and login popup pages and

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.