0

我在 ite 内的段落中的 div 中有多个值 如何将其发送到服务器?

<tr>
  <td><font face="Arial">Answers</font></td>
  <td>
     <input type="text" name="T2" size="20" id="answer">
     <input type="button" value="+" name="B3" id="btnAnswer" onclick="addAnswers()">
     (click on this button will create another field so you can type content
     for the other answer, this can be done using jquery)<br>
     <div id="answers"></div>
     <input type="checkbox" name="c" value="1">Allow this answer to be free text
  </td>
</tr>

在 js 文件中:

 function addAnswersnew(answer){
    $('#answers').append('<p>' + $('#answer').val() + '</p>'); 
}

现在,当我向这个 div 添加 4 个答案时,说 ans1、ans2、ans3 和 ans4。如何将其发送到服务器?

4

1 回答 1

0

Maybe you can do this:

function getAnswersnew(){
   var answer = new Array();
   $(selector).each(function(){
     answer($(this).val());
   });
}

'selector' can be a css class for all answer, you can now get all the answer stored in the array and send to the server.

于 2012-08-16T21:28:16.063 回答