How to store input type checkbox into json object using either Javascript or jQuery? -


i wanted store clicked input accordions(<input type="checkbox">) json object, have tried storing/taking last input accordion clicked event only, not storing/taking input clicked accordions whatever click on accordion(of <input type="checkbox">) should store json object using either javascript or jquery ?

i not sure doing wrong ? please me regarding ? in advance. sample fiddle.

because doing submitbuttonvalue[name] = $(this).val(); , name getting $(this).attr('name'); on click of checkbox same checkboxes. everytime replaces value since object have 1 name contained. suggest either use different names each checkbox or find other way uniquely store checkbox values.

a demo here


Comments