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 8467895
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T15:46:41+00:00 2026-06-10T15:46:41+00:00

I am trying to use twitter bootstrap modal instead of custom confirm dialog. my

  • 0

I am trying to use twitter bootstrap modal instead of custom confirm dialog.

my function

function getConfirm(confirmMessage){
    if ( confirmMessage == undefined){
        confirmMessage = '';
    }
    $('#confirmbox').modal({
    show:true,
        backdrop:false,
        keyboard: false,
    });

    $('#confirmMessage').html(confirmMessage);
    $('#confirmFalse').click(function(){
        $('#confirmbox').modal('hide');
        return false;
    });
    $('#confirmTrue').click(function(){
        $('#confirmbox').modal('hide');
        return true;
    });
}   
</script>
<div class="modal" id="confirmbox" style="display: none">
    <div class="modal-body">
        <p id="confirmMessage">Any confirmation message?</p>
    </div>
    <div class="modal-footer">
        <button class="btn" id="confirmFalse">Cancel</button>
        <button class="btn btn-primary" id="confirmTrue">OK</button>
    </div>
</div>

calling the function

var confimChange=getConfirm("Do You confirm?");
if(confimChange){
    alert('perfect you confirmed')
}else{
    alert('why didnt you confirmed??')
}

the problem is getConfirm function is not returning true or false.


WORKING CODE:

if(receiverListCount > 0){
    var confimChange=confirm("Message");
    if(confimChange){
        resetReceiverList();
    }else{
        return false;
    }
}

code piece after modifications & changes /not working

if(activeDiv == '#upload'){
    if(listOfSelectedGroups.length> 0|| receiverListCount > 0){
        getConfirm("message",function(result){
            if(result){
                resetReceiverList();
            }else{
                return false;
            }
        });
    }
}

finaly I decided to use bootboxjs

  • 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-10T15:46:43+00:00Added an answer on June 10, 2026 at 3:46 pm

    Your approach is wrong, it will execute kind of asynchronously so that it won’t wait for the modal dialog to be closed before returning. Try something like this:

    function getConfirm(confirmMessage,callback){
        confirmMessage = confirmMessage || '';
    
        $('#confirmbox').modal({show:true,
                                backdrop:false,
                                keyboard: false,
        });
    
        $('#confirmMessage').html(confirmMessage);
        $('#confirmFalse').click(function(){
            $('#confirmbox').modal('hide');
            if (callback) callback(false);
    
        });
        $('#confirmTrue').click(function(){
            $('#confirmbox').modal('hide');
            if (callback) callback(true);
        });
    }  
    
    getConfirm('Are you sure?',function(result) {
       // Do something with result...
    });
    

    Note however you only really need to initialize the modal once and hook the events once. I’d give the modal body and ID and simply change the content before showing.

    You should also set backdrop to true, you want a confirmation to prevent the user from accessing the page until they confirm.

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

Sidebar

Related Questions

I am trying to use Twitter Bootstrap tabbable and Bootstrap popovers in a same
I am trying to use Twitter Bootstrap for GWT and get the same nice
I'm trying to use twitter bootstrap to create Facebook like tooltip layout. I would
I have recently started to use Twitter Bootstrap and trying to understand how it
I'm trying to use the rottentomatoes movie API with twitter's bootstrap typeahead plugin but
I'm trying to use Twitter Bootstrap Twipsy as a hovering tooltip with a link
I'm trying to use Twitter Bootstrap in Django. I've got it working for the
Possible Duplicate: How to use Twitter Bootstrap popovers for jQuery validation notifications? Trying to
I am trying to use Twitter's bootstrap CSS framework and within there so far
I'm trying to use https://github.com/mgussekloo/my-bootstrap-datetimepicker with twitter bootstrap but it doesn't work. I don't

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.