2013-04-28 24 views
0

我正在制作一个网站的原型,我试图让它看起来像一个人提交表单,以便在引导模式中接收他们的信息。如何在用户按下自举模式提交表单后显示成功消息?

我有这样的记录在我的网页上:“遗忘”

<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> 

我想会发生什么,当一个人点击“获取我的个人资料!”我想以模式或其他模式显示问候消息或其他内容。

任何想法将不胜感激! :)

/比尔

+0

你想一个模式内的模式,以显示细节? – PSL 2013-04-28 18:45:37

+0

为了显示“谢谢你,我们现在给你发送你的详细资料”或类似的东西:) – 2013-04-28 18:46:43

+0

我只是想在一个人“提交”(这只是一个原型)接收他们的细节后显示一个很好的问候消息。 – 2013-04-28 18:48:08

回答

1

您需要使用事件代表团的任何点击事件happes。看看这是否满足您的需求。这将在模式本身中显示消息。

http://jsfiddle.net/spaXZ/

$('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>')); 
}); 
如果你想显示为模态,你可以尝试这个

: - http://jsfiddle.net/HxrHd/

+1

再次感谢@PSCoder!你的例子,“显示为模态”,正是我想要实现的!非常感谢! – 2013-04-28 21:37:05

+0

没问题...很高兴帮助你! – PSL 2013-04-28 21:39:12

相关问题