Skip to main content

confirm

Description

Calls a confirm message box

confirm: (config: ConfirmBoxConfig | string | number) => HTMLElement

Parameters

  • config - (required) ConfirmBoxConfig | string | number - either an object with the confirm box's configuration or the text to show

Returns

  • div - (HTMLElement) - the div container of the confirm box

Example

var box = gantt.confirm({
text: "Continue?",
ok:"Yes",
cancel:"No",
callback: function(result){
if(result){
gantt.message("Yes!");
}else{
gantt.message("No...");
}
}
});

// or
var box = gantt.confirm("Do you want to continue?");

Details

The configuration object uses the following properties:

  • id? - (number | string) - optional, the ID of the confirm box
  • text - (number | string) - the text of the confirm box's body
  • title? - (number | string) - optional, the text of the header
  • ok? - (number | string) - optional, the text of the "OK" button
  • cancel? - (number | string) - optional, the text of the "Cancel" button
  • position? - (string) - optional, the position of the confirm box for now supports only one value - "top", any other value will result in "center-align"
  • width? - (string) - optional, the width of the confirm box (set as CSS <length> or <percentage> values, e.g. "100px", "50%")
  • height? - (string) - optional, the height of the confirm box (set as CSS <length> or <percentage> values, e.g. "100px", "50%")
  • callback? (result): void - optional, the function called on button click. Takes true or false as a parameter (subject to the clicked button)
    • result - (boolean) - result of the clicked button: true for "OK", false for "Cancel".

For additional details about supported configuration options of a confirm message box, see the Popup Messages and Modal Boxes article.

Change log

  • added in version 4.0