我有一個分爲兩個部分的頁面。所以首先看到第一部分,我們需要填寫輸入值,當我們點擊轉到下一頁按鈕時第一部分現在隱藏,第二部分顯示。然後我們只能提交表格。 現在我想的是,在第一部分中,我有四個輸入,比如圖所示在提交表單前顯示錶單數組的輸入值
<div class="room_details_first col-md-12" id="first_order">
<div class="col-md-3">
<input type="text" placeholder="Food items" name="others_food_items[]" data-view-id="#location"/>
</div>
<div class="col-md-3">
<input type="text" placeholder="Hotel Name" name="others_hotel[]"/>
</div>
<div class="col-md-3">
<input type="text" placeholder="Hotel price" name="others_hotel_price[]"/>
</div>
<div class="col-md-3">
<input type="text" placeholder="Customer Price" name="others_client_price[]"/>
</div>
</div>
現在,通過使用jQuery我有追加輸入和代碼如下所示
function add_others_order(){
var output="";
output+= '<div class="room_details_first col-md-12" id="first_order">';
output+='<div class="col-md-3"><input type="text" placeholder="Food items" name="others_food_items[]" data-view-id="#location"/></div>';
output+='<div class="col-md-3"> <input type="text" placeholder="Hotel Name" name="others_hotel[]"/> </div>';
output+='<div class="col-md-3"><input type="text" placeholder="Hotel price" name="others_hotel_price[]"/></div>';
output+='<div class="col-md-2"> <input type="text" placeholder="Customer Price" name="others_client_price[]"/></div>';
output+='<div class="col-md-1" ><a href="javascript:void(0)" id="removeOtherOrder"><i class="fa fa-remove"></i></a></div>';
output+='</div>';
$('#first_order').after(output);
}
現在該怎麼辦我需要的是我需要在提交之前保存輸入值,並將其列在頁面的第二部分。我試圖做到這一點,但我失敗了很多次。而且我還發現這是下面
Display the data entered in a form before submitting the form
實際上我仍然混淆有關流,正如我的理解,當用戶點擊第一節中的下一個按鈕時,第一節html應該被複制到下一節,那是你想要的嗎? – Jigar7521
對不起,我無法正確澄清我的問題。是的,我需要在第二部分顯示輸入值,但我有一個輸入字段,即客戶價格。我需要顯示所有的輸入列表,並最終總結客戶價格的價值也是如此總的客戶價格 –