javascript - Bootbox:如何添加 'prompt'

标签 javascript twitter-bootstrap flask prompt bootbox

您能帮我启发一下吗?我有以下问题

jcertify.html中有:

<!-- Bootbox utilities 
    ================================================== -->
    <script src"../static/assets/js/email_sign_up.js"></script>
  </body>

email_sign_up.js中有:

function    emailSignUp( )
{
    bootbox.prompt("<strong>Email address</strong>Enter email address where the report should be send to : ", function(result)  {                
        if (result) {   
            // Example.show("email: <b>"+result+"</b>");    
            console.log("NikoS");
        } 
    });
}

jcertify.html中,它就像:

<p><a href="javascript:console.log('hi there');emailSignUp();" class="bb-trigger btn btn-primary btn-lg btn-block">Sign up</a></p>

在浏览器的调试器中,当我单击“注册”按钮时,我看到的是:

[日志] 你好(jcertify,第 1 行) [错误] ReferenceError:找不到变量:emailSignUp 全局代码(jcertify,第 1 行)

你知道我做错了什么吗?

最佳答案

检查这个jsfiddle:

http://jsfiddle.net/f75nfL26/1/

HTML:

<a class="bb-trigger btn btn-primary btn-lg btn-block">Sign up</a>

JS:

$('.bb-trigger').on("click", function(e) {
bootbox.prompt("<strong>Email address</strong>Enter email address where the report should be send to : ", function(result)  {                
    if (result) {   
        // Example.show("email: <b>"+result+"</b>");    
        console.log("NikoS");
    } 
});

});

那里工作正常

关于javascript - Bootbox:如何添加 'prompt',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/26783424/

相关文章:

javascript - angular-ui-tabset:更改事件选项卡内容

php - 哪一端创建 session /cookie?

javascript - Bootstrap datepicker 日期比较错误(英国/美国格式错误)

javascript - Bootstrap 自定义 JavaScript 文件未加载(Rails 4)

python - 没有名为 flask.ext.wtf 的模块

javascript - 我应该如何设置 createAsyncThunk 中的参数和参数?

javascript - 变量声明是否与变量的绑定(bind)相同?

html - Bootstrap btn 组垂直文本对齐

python - 将 json 转换为 Graphite 烯 graphql 响应

python - ModuleNotFoundError : No module named 'fcntl'