简体   繁体   English

引导程序/模式警报-日志显示无警报

[英]Bootstrap / Modal alert - log shows with no alert

Basically, the extension I am working on is supposed to show an alert box when clicked. 基本上,我正在使用的扩展名应该在单击时显示一个警告框。 However the button does it's job by going to the next step "skipping verification" without showing the box as it should. 但是,该按钮可以通过执行下一步“跳过验证”来完成它的工作,而无需显示该框。

When the button is clicked, I receiving this back from the console. 单击按钮后,我从控制台收到了回信。

    $("#usps_skip").click(function() {
        console.log("skipCLicked");
        var msg = "No address information will be stored with the Contact record if you skip USPS  verification. Do you still wish to skip the USPS verification step?";
        $('#errorModal .modal-body').html(msg.split('\n').join('<br />'));
        $('#errorModal').modal('show');
    });

The "skipCLicked" log is showing up in the console, but the actual modal message alert is not appearing. 控制台中将显示“ skipCLicked”日志,但是没有出现实际的模式消息警报。 Any suggestions? 有什么建议么?

Below is my code in the chrome extension. 以下是我在chrome扩展程序中的代码。

  • js code js代码

      switch(ObjField.id) { //other case code removed since it is not necessary case "usps_skip": str_field = str_field + '<button class="btn btn-danger" data-target="#errorModal" name="'+ObjField.name+'" id="'+ObjField.id+'" value="">'+ObjField.label+'</button>'; //str_field = str_field + '<button type="button" class="btn btn-danger" data-toggle="modal" data-target="#errorModal" name="'+ObjField.name+'" id="'+ObjField.id+'" value="">'+ObjField.label+'</button>'; break; 
  • modal / tabs.htm 模态/ tabs.htm

    <div id="errorModal" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button> <h4 class="modal-title">Error</h4> </div> <div class="modal-body"> <p></p> </div> <div class="modal-footer"> <button type="button" id="modalSkip" class="btn btn-success" data-dismiss="modal">Skip Verification</button> <button type="button" class="btn btn-danger" data-dismiss="modal">Close</button> </div> </div> </div> </div>

The button works as it should but no message shows, any help would be appreciated. 该按钮可以正常工作,但不会显示任何消息,将不胜感激。

Edit: console.log("skipCLicked"); 编辑:console.log(“ skipCLicked”); is shown via console, so it works up to that point. 通过控制台显示,因此可以正常工作。

Did You try: 你试过了吗:

$('#myModal').on('shown.bs.modal', function (e) {
  console.log('is modal open?'); // does it shown in console? if not then modal is not open.
  // do something... like $('#errorModal .modal-body').html(msg.split('\n').join('<br />'));
});

Ps. PS。 if console.log('is modal open?') shown in console then You must check why modal is invisible. 如果console.log('是否是模式打开的?')在控制台中显示,那么您必须检查为什么模式是不可见的。 There can be many reasons, no height/width , to low z-index etc. 可能有很多原因,没有高度/宽度,z-index低等。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM