Monday, May 20, 2024
88
rated 0 times [  94] [ 6]  / answers: 1 / hits: 25822  / 10 Years ago, mon, june 23, 2014, 12:00:00

I'm wondering how remove the X button that shows up on Bootbox alerts, confirms, prompts and dialogs.



There are cases where you'd wish to require the user to provide a response--not just dismiss the pop-up with a click on the X button.



Does anyone have an idea of how to remove this button?


More From » twitter-bootstrap

 Answers
3

I ended up finding the solution, and it is fairly easy (but doesn't seem to be in the current Bootbox documentation.)



The solution works for Bootbox Dialogs, so if you need to remove the X for other types of boxes, I'd suggest imitating the other, more primitive types of boxes as a dialog.



The solution, which uses closeButton: false, is seen in the snippet below:



        bootbox.dialog({
closeButton: false,
title: Woah this acts like an alert,
message: Cool info for you. You MUST click Ok.,
buttons: {
success:{
label: Ok,
callback: callback
}
}
});

callback(){//stuff that happens when they click Ok.}


By making sure the user must click on a button to dismiss the box, we can make sure they trigger an appropriate callback function.


[#70468] Friday, June 20, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ariel

Total Points: 523
Total Questions: 111
Total Answers: 100

Location: Anguilla
Member since Sun, Jan 29, 2023
1 Year ago
;