您能帮我启发一下吗?我有以下问题
在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/