0

btn-dangerカスタムの確認ダイアログがあり、ボタンにタブインデックスを付けて、Enter でフォームを送信できるようにしたいと考えています。

それを達成する方法は?

var config = {
    title: 'Confirm approval removal',
    message: "<em>" + self.$label.text() + "</em> is about to be removed. Please confirm the action.",
    buttons: {
        'cancel': {
            label: 'Keep approval',
            className: 'btn-default'
        },
        'confirm': {
            label: 'Remove approval',
            className: 'btn-danger'
        }
    },
    callback: function(result) {
        if (result) {
            self.$approvedCheckbox.prop('checked', false);
        } else {
            self.$approvedCheckbox.prop('checked', true);
            self.$requiredCheckbox.prop('checked', false);
        }

        self.markRequiredFields();
    }
};

bootbox.confirm(config);

tabindex 属性を追加しようとしましたが、うまくいきませんでした。

4

1 に答える 1

0

クラスを持つボタンは、btn-primary入力完了のためにオートフォーカスを取得します。また、次のものと連携しbtn-dangerます。

var config = {
    ...
    buttons: {
        'cancel': {
            label: 'Keep approval',
            className: 'btn-default'
        },
        'confirm': {
            label: 'Remove approval',
            className: 'btn-danger btn-primary' // this button will get the index and will be submitted on enter
        }
    },
    ...
};


bootbox.confirm(config);
于 2014-07-21T14:12:30.653 に答える