3

While using Bootstrap 2.3, Bootbox and viewing the result in Google Chrome on Ubuntu you get a less than appealing border around the button because it is auto-focused. I havent found any api hooks to trigger a blur event once the modal is shown. Is there a way to remove the autofocus with javascript alone or maybe just css but without the option to fork the project, remove the autofocus and make it configurable?

bootbox-autofocus

2
  • 1
    You can inspect and see if there is any class / id applied to button which will help you to select it to trigger blur() event..
    – Rahul
    Dec 21, 2013 at 16:25
  • 1
    Thanks Rahul -- I used a.btn:focus { outline: none; } Dec 21, 2013 at 19:28

1 Answer 1

0

There is no API hook, but you can do it by attaching a javascript event handler to the alert:

var bbAlert = bootbox.alert('Alert!')

bbAlert.on('shown.bs.modal', function(){
    $('.btn-primary').blur();
});

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.