[英]how can I include the label of a text field on form submit
我有一個可以動態創建文本字段和文本字段標簽的表單。 當我使用this.form獲取提交的信息時,我僅獲得文本字段,這意味着沒有附帶的標簽幾乎沒有意義。
下面是該文本的節略版本,我希望足夠。 如果有幫助,我正在使用jQuery。
動態創建的表單:/
/dynamically created based on choice options from a form
<input type="text" id="cV_'+curChoice+'" class="numeric" size="1" value="1"> <label for="cV_'+curChoice+'">'+curChoice+'</label><br><hr>'
<input class='action' id='saveButton' type='button' value='SAVE' onclick='saveChoices()' />
<script>
function saveChoices(){
var choiceNum = this.form;
}
我想出了一個解決方案。 我必須在該字段中添加一個名稱。
$('#choices').append('<input type="text" name="'+curChoice+'" class="numeric" size="1" value="1">'+curChoice+'<br><hr>');
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.