Bootstrap确认(删除点击功能?)

时间:2017-08-25 13:03:58

标签: javascript twitter-bootstrap

我刚刚开始学习自助训练,我想问一个问题。

我正在使用" bootstrap确认"在下面用URL引用。 https://github.com/mistic100/Bootstrap-Confirmation/blob/master/example/index.html

我试图使用自举确认的自定义按钮 我也有这个按钮的点击功能。

但问题是当我点击按钮时它会自动显示确认框。 我想在调用函数时显示它,

$("#button_id").confirmation("show");

如前所示,我显示确认框,我必须检查验证并首先得到结果......

有什么办法吗? ..

离)

$("#button_id").confirmation({
          rootSelector: '',
          container: 'body',
          buttons: [
            {
              class: 'class',
              value: 'YES',
              label: 'YES',
              onClick:function(){
              }
            }
          ]
        });

2 个答案:

答案 0 :(得分:0)

<强> HTML

$("#bt1").click(function() {
  var test = prompt("test");
     if( test == "test"  )
   {
     $('#bt1').confirmation("show");
   }
});

<强> JS

C:\Program Files (x86)\Java\jdk1.8.0_144

希望这会有所帮助。 :)

答案 1 :(得分:-1)

function validate() {
    return true;
}

$('#id').click( function() {
    var valid = validate();
    if(valid) {
        $('#id').modal('show');
    }
});