Dynamically add and remove TextBoxes and get value of dynamic TextBox using jQuery and display it in a textbox
<p>i have code where you can add or delete textbox using .append()  and .remove() in jquery, now i want to implode all the value of the textboxes separated by commas and pass it into another textbox located outside the script. how can i do it?  here's the code for dymically adding and removing textbox. (not mine just got it here in stackoverflow)
HTML:</p>

<pre><code>&lt;input id="btnAdd" type="button" value="Add" /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;div id="TextBoxContainer"&gt;
&lt;!--Textboxes will be added here --&gt;
&lt;/div&gt;
&lt;br /&gt;
&lt;input id="btnGet" type="button" value="Get Values" /&gt;
</code></pre>

<p>javascript:</p>

<pre><code>&lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs /jquery/1.8.3/jquery.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;
$(function () {
$("#btnAdd").bind("click", function () {
    var div = $("&lt;div /&gt;");
    div.html(GetDynamicTextBox(""));
    $("#TextBoxContainer").append(div);
});
$("#btnGet").bind("click", function () {
    var values = "";
    $("input[name=DynamicTextBox]").each(function () {
        values += $(this).val() + "\n";
    });
    alert(values);
});
$("body").on("click", ".remove", function () {
    $(this).closest("div").remove();
});
});
function GetDynamicTextBox(value) {
return '&lt;input name = "DynamicTextBox" type="text" value = "' + value + '" /&gt;&amp;nbsp;' +
        '&lt;input type="button" value="Remove" class="remove" /&gt;'
}
&lt;/script&gt;
</code></pre>