Javascript 在bootstrap模式中按下提交表单后,如何显示Success消息?
我正在制作一个网站的原型,我试图让它看起来像一个人提交一个表格,以便在引导模式中接收他们的信息 我已在页面顶部登录此日志:Javascript 在bootstrap模式中按下提交表单后,如何显示Success消息?,javascript,jquery,html,css,twitter-bootstrap,Javascript,Jquery,Html,Css,Twitter Bootstrap,我正在制作一个网站的原型,我试图让它看起来像一个人提交一个表格,以便在引导模式中接收他们的信息 我已在页面顶部登录此日志: <div class="center-top-div"> <form class="well inline-form" action="sidor/my_page.html" method=""> <input type="text" class="span2" placeholder="Usernam
<div class="center-top-div">
<form class="well inline-form" action="sidor/my_page.html" method="">
<input type="text" class="span2" placeholder="Username">
<input type="password" class="span2" placeholder="Password">
<a href="sidor/index_inloggad.html" class="btn btn-small btn-primary pull-right" id="logga-in-btn">Log in</a><br>
<a class="pull-right" id="amnesi" href="#myModal" data-toggle="modal">Forgotten?</a>
</form>
</div>
当按下“遗忘”链接时,将显示一个模式:
<div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 id="myModalLabel">Vi behöver din E-postadress!</h4>
</div>
<div class="modal-body">
<form class="well inline-form larger-input">
<input class="input-large" type="text" class="span2" placeholder="Din E-postadress...">
<a href="//I WANT THIS TO LINK TO ANOTHER MODAL/GREETING MESSAGE" class="btn btn-small btn-primary pull-right"
id="logga-in-btn">Get my details!</a><br>
</form>
</div>
<div class="modal-footer">
<button class="btn" data-dismiss="modal" aria-hidden="true">Close</button>
</div>
</div>
×
Vi behöver din E-PostAddress!
接近
我想做的是,当一个人点击“获取我的详细信息!”时,我想在模态或其他模态中显示问候信息或其他内容
任何想法都将不胜感激!:)
/Bill对于要发生的任何单击事件,都需要使用事件委派。看看这是否满足你的需要。这将在模式本身中显示消息
$('body').on('click','#logga-in-btn' ,function(){
$(this).closest('.modal-body').find('#grtmessage').remove().end().append($('<span id="grtmessage">Thank you, we have now email you your details</span>'));
});
$('body')。在('click','logga in btn',function()上{
$(this).closest(“.modal body”).find(“#grtmessage”).remove().end().append($(“谢谢,我们现在通过电子邮件向您发送您的详细信息”);
});
如果您想显示为模态,您可以尝试以下操作:-您想在模态中显示详细信息吗?要显示“谢谢,我们现在给您发送电子邮件您的详细信息”或类似内容:)我只想在一个人“提交”后显示一条漂亮的问候语(这只是一个原型)感谢您收到他们的详细信息。看看这是否是您想要的?再次感谢@PSCoder!您的示例“显示为模态”正是我想要实现的!非常感谢!
$('body').on('click','#logga-in-btn' ,function(){
$(this).closest('.modal-body').find('#grtmessage').remove().end().append($('<span id="grtmessage">Thank you, we have now email you your details</span>'));
});