2014-11-08 31 views
0

我有一個可以爲文本字段動態創建文本字段和標籤的表單。當我使用這個表單來獲取提交的信息時,我只能得到文本字段,這意味着很少沒有標籤的文本字段。如何在表單上提供文本字段的標籤提交

下面是我希望的文本的刪節版本。如果有幫助,我正在使用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; 
} 

回答

0

我想出了一個解決方案。我必須在該字段中添加一個名稱。

$('#choices').append('<input type="text" name="'+curChoice+'" class="numeric" size="1" value="1">'+curChoice+'<br><hr>'); 
相關問題