JQuery. need help thinking through how to build dynamic fields related to a previous dynamic field
<p>This page allows users to add questions dynamically (this part works), within each question a user can add one to many answers which are also dynamic. Here's a wire frame of the page which might help: <a href="https://gomockingbird.com/mockingbird/#2ql43kg/0W2gD1" rel="nofollow">https://gomockingbird.com/mockingbird/#2ql43kg/0W2gD1</a></p>

<p>As I said, the question part is done and the fields are being posted from the form correctly.</p>

<p>I need some help thinking through how to go about adding the answer area. Here is my code thus far.</p>

<pre><code>&lt;script&gt;
currentQuestion = 1;

 function addQuestion(){
// Clone our question container and assign it a new ID
var newElement = $('#questionContainer0').clone().attr('id','questionContainer'+currentQuestion);
// Update the ID and Name of the textarea in our question container
newElement.children('#question0').attr('id','question'+currentQuestion).attr('name','question'+currentQuestion);
// Append our new question container to the bottom
newElement.appendTo('#questionArea');

currentQuestion++;
}

function addAnswer(){
//var newAnswer = $('#question0-answer1').clone().attr('id','question0-answer2').attr('name','question0-answer2');
//newAnswer.appendTo('#answerContainer0');
}
&lt;/script&gt;
&lt;/head&gt;

&lt;form method="post" action="test.cfm"&gt;
&lt;div id="questionArea"&gt;
&lt;div id="questionContainer0" class="questionContainer"&gt;
    &lt;textarea id="question0" name="question0"&gt;&lt;/textarea&gt;
    &lt;div id="answerContainer0"&gt;
    &lt;input type="text" id="question0-answer1" name="question0-answer1" /&gt;
    &lt;p&gt;&lt;a href="#" onClick="addAnswer();" id="add"&gt;Add Answer&lt;/a&gt;&lt;/p&gt;
&lt;/div&gt;  
&lt;/div&gt;

&lt;input type="submit" value="go" name="submit"&gt;
&lt;/form&gt;
&lt;a href="#" onClick="addQuestion();" id="addQuestion" title="Add a question" class="link-sm" style="background-color:red;"&gt;Add Question&lt;/a&gt;
</code></pre>

<p>FWIF, I am new to JQuery and if how I am approaching this is wrong entirely, please let me know :) - I am sure there is a slicker way to do it without writing an addQuestion function and calling it with an onClick.</p>
