簡體   English   中英

在按下人員以自舉模式提交表單后,如何顯示成功消息?

[英]How can I display a sucess message after person pressed submitted a form in bootstrap modal?

我正在制作一個網站的原型,並且試圖使它看起來像一個人,以一種提交形式接收表單的信息。

我在頁面頂部登錄:

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

我想發生的是,當一個人單擊“獲取我的詳細信息!”時, 我想以模式或其他模式顯示問候消息或其他內容。

任何想法將不勝感激! :)

/法案

您需要將事件委派用於所有發生的單擊事件。 看看這是否滿足您的需求。 這將在模式本身中顯示消息。

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/

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM