Get checkbox values in array according to parent div ;jquery -


i have 3 divs checkboxes in it.

   <div id="mydiv1">     <input type="checkbox"  name="newcheckboxes" value="1"  />     <input type="checkbox"  name="newcheckboxes" value="2"  />     <input type="checkbox"  name="newcheckboxes" value="3"  />     </div>      <div id="mydiv2">     <input type="checkbox"  name="newcheckboxes" value="1"  />     <input type="checkbox"  name="newcheckboxes" value="2"  />     <input type="checkbox"  name="newcheckboxes" value="3"  />     </div> 

i have working code values in array

    function updatetextarea() {             var allvals = [];            var parent = $(this).parent("div");              $('#c_b :checked').each(function () {                 allvals.push($(this).val());            });            var removeitem = 'on';            allvals = jquery.grep(allvals, function (value) {                return value != removeitem;            });            //set value of hidden field            $("#<%= hfsearchdata.clientid %>").val(allvals);          }        $(function () {             $('#c_b input').click(updatetextarea);            updatetextarea();        });` 

now want separate values in different arrays according divs

ex. array 1 mydiv1; array 2 mydiv2

i tried checking parent div not useful

thanks.


Comments

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -