ua_boaz ua_boaz - 1 year ago 104
Javascript Question

bootbox 4.4 how to alert with different button label

i see in bootbox v3 documentation you can change the label by using below method
bootbox.alert(str message, str label, fn callback) Custom button text, callback invoked on dismissal,

However on version 4.4 this method does not seem to work, how can i get to use a custom button label on alert message

Answer Source

You can try something like this:

   size: 'small',
   message: "Your message hereā€¦", 
   callback: function(){ /* your callback code */ }
    $('.btn.btn-primary').text('Custom Text')

From the docs: bootbox.init(function): Allows the user to supply a function to be called when dialog gets initialized.