jquery - Capture the value of two set of checkboxes into two separate strings -


i have 2 set of checkboxes, , value of checked checkboxes should mapped 2 different strings. understood on how use map function mentioned here using jquery multiple checkbox's value , output comma separated string.

but cant understand how separate these 2 sets.

vv

<input type="checkbox" class="form-checkbox" id="input_36_0" name="q36_vv[]" value="cc" /> <label for="input_36_0">cc</label> <input type="checkbox" class="form-checkbox" id="input_36_1" name="aa[]" value="bb" /> <label for="input_36_1">b</label> <br> <label class="form-label-left" id="label_37" for="input_37">xx</label>      <input type="checkbox" class="form-checkbox" id="input_37_0" name="q37_businesstype[]" value="yy" />     <label for="input_37_0">yy</label>     <input type="checkbox" class="form-checkbox" id="input_37_0" name="q37_businesstype[]" value="zz" />     <label for="input_37_0">zz</label> 

try using id attribute

var x1 = $('.form-checkbox[id^="input_36_"]:checked').map(function(){     return this.value }).get().join();  var x2 = $('.form-checkbox[id^="input_37_"]:checked').map(function(){     return this.value }).get().join(); 

Comments

Popular posts from this blog

assembly - 8086 TASM: Illegal Indexing Mode -

Java, LWJGL, OpenGL 1.1, decoding BufferedImage to Bytebuffer and binding to OpenGL across classes -

javascript - addthis share facebook and google+ url -