Instead of that I can use also below CDN link Wrappers for JavaScript alert(), confirm() and other flexible dialogs using the Bootstrap framework. CDN for web related libraries to speed up your websites!
- title: "This is a prompt with a textarea!",
- inputType: 'textarea',
I use callback function to get the result from text area.
A callback handles the user's selection. The callback function is passed a value of true or false, depending on which button the user pressed. Any code that depends on the user's selection must be placed in the callback function.
Prompt
A dialog prompts for user input. Pressing the ESC key or clicking close dismisses the dialog and invokes the callback as if the user had clicked the cancel button.
Prompt dialogs require a callback function.
A dialog prompts for user input. Pressing the ESC key or clicking close dismisses the dialog and invokes the callback as if the user had clicked the cancel button.
Prompt dialogs require a callback function.
All Bootstrap modals, unlike native alerts, confirms, or prompts, generate non-blocking events. Keep that in mind when using the prompt()
dialog, as it is not a drop-in replacement for native prompt dialogs. Any code that depends on the user's input must be placed in the callback function.
Prompt requires the title
option (when using the options object) and disallows the message
option.
Prompt Dialog Options
Prompt dialogs are (by default) single-line text inputs. You can modify the type of prompt Bootbox generates using the prompt-only options below.
- Name - value , Description : You can set the initial value of the prompt using the
value
option. - Name - inputType , Description : Changes the type of input generated for the prompt dialog. Valid values for inputType are: text (default), textarea, email, select, checkbox, date, time, number, and password.
- Name - inputOptions , Description : If you specify select or checkbox as the input type, you must also supply an array of valid values in the format of : {text: '', value: '', group: '' }
group
is an optional property for populating the <select>
; if specified, <optgroup>
elements will be generated for each group value found in the inputOptions
array.
Example 1
- bootbox.confirm({
- message: "This is a confirm with custom button text and color! Do you like it?",
- buttons: {
- confirm: {
- label: 'Yes',
- className: 'btn-success'
- },
- cancel: {
- label: 'No',
- className: 'btn-danger'
- }
- },
- callback: function (result) {
- bootbox.alert('This was logged in the callback: ' + result);
- }
- });
URL IS - http://localhost:57237/Home/BootBox
OUTPUT 1This Will Show you Yes /No Button and after click It will show you True / False.
Desktop View