jquery - add values to javascript variable - object -


After

I am trying to add value here:

  on selected_value = {addtypeid : Addtypeid, isnew: isnew, geographicareaid: geographicareaid, catID: catID, catid2: catid2, manufacturerid: manufacturerid, modelid: modelof, yearofmanufacturing_from: yearofmanufacturing_from, yearofmanufacturing_to: yearofmanufacturing_to;};  

Use of this code:

  var categories = []; $ ("Input [name = 'categories filter []']: checked"). Each (function () {var id = $ (this) .attr ("id"); var value = $ (this) .val () categories [categories.length] = {id: value};}); $ .each (categories, function (id, value) {// warning ('id:' + id + 'value:' + value); selected_value.id = value;});  

However, only the following is added to the following format in the check box:

  id [id] 166  

I want to do all the check boxes in the format where:

  166: 166,  

Can anyone help me with this < / P>

Regards, John

Try it:

  $ ("Input [name = 'categories filter []']: checked"). Each (function () {var id = $ (this) .attr ("id"); var value = $ (this) .val (); Categories.push ({id: id, value: value});} ; $ .eEC (categories, jobs (id, items) {// warning ('id:' + id + 'value:' value =); selected_man [item.id] = item.value;});  

Comments