我有一個網頁,其中有一個「更改」按鈕。當您單擊該按鈕時,會出現一個模式,要求用戶輸入一個數字。我需要能夠保存用戶輸入的號碼並將其顯示在網頁中。我在表單中創建了模式,但我不確定如何在網頁中顯示更改。 是這樣的:Modal:如何保存一個值並將其顯示在頁面中
<a class="btn btn-primary" data-toggle="modal" data-target="#moneyModal">
<span class="glyphicon glyphicon-money glyphicon-white"></span>Change</a>
<div class="modal fade" id="moneyModal" role="dialog">
<div class="modal-dialog">
<form method="post" action="change-goal">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">Change Goal</h4>
</div>
<div class="modal-body">
<p>Please enter a new number.</p>
</div>
<div class="modal-body">
<input class="form-control" name="newGoal" id="newGoal">
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="submit" class="btn btn-primary" >Save</button>
</div>
</div>
</form>
</div>
</div>
所以,我的問題將是如何顯示點擊「保存」按鈕後,在輸入字段(ID = newGoal)由 用戶輸入的值。 真的很感謝幫助。
它worked.Thanks!我需要什麼才能保存該值,以便在刷新頁面時,該值仍然存在 – AJth
爲此啓動一個新問題 - 這將需要cookie或服務器端的某些內容。 –