With JQuery how can you make an array of inputs from checkboxes into one variable?
<p>I would like to make the data from this jquery submit go into one variable that I can put into html.  I am using the append button to add html to my form, but can't figure out how to make the <code>data</code> variable into an array of each check box value .</p>

<p><a href="https://jsfiddle.net/soljohnston777/k5yc1y2a/2/" rel="nofollow">https://jsfiddle.net/soljohnston777/k5yc1y2a/2/</a></p>

<p>JQuery:</p>

<pre><code>$(".checkboxadd").click(function(){
                $('[id^="add_policies_checkbox"]').each(function(i, v){
                  //alert(this.value);
                  if($(v).prop('checked')){
                  var data=$(v).val();
                  $("#div_to_add_this_checkbox_value").append("&lt;input type=hidden name='pnpID_instructions' value=\'"+data+"\' /&gt;P&amp;P #'s: "+data+"");}
                });
});//end ajaxifypolicies
</code></pre>

<p>HTML:</p>

<pre><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;input type="checkbox" value="1" id="add_policies_checkbox1"/&gt;
  &lt;input type="checkbox" value="2" id="add_policies_checkbox2"/&gt;
  &lt;input type="checkbox" value="3" id="add_policies_checkbox3"/&gt;
  &lt;button class="checkboxadd"&gt;Submit&lt;/button&gt;
&lt;div id="div_to_add_this_checkbox_value"&gt;&lt;/div&gt;
&lt;div&gt; Check mark all 3 then hit submit, What I want is the output like an array:&lt;br&gt;P&amp;P #'s:1,2,3 &lt;br&gt; (and the hidden value="1,2,3")
&lt;/div&gt;
</code></pre>