Can someone help me to get opid to be populated. The selectors all work correctly, and the code cycles the correct elements (tested this with an alert). Problem is I need to get the values I cycle in the each statement out and into the wrapping click function.
Anyhelp would be appreciated. At the moment I get an opid[i] undefined error.... Thanks for any help you can offer var opid = new Array(); $("a.btn.submit").click(function(){ // alert($(this).attr("id").substr(7)); var userid = $(this).attr("id").substr(4); $("#"+userid+" input:disabled").each(function(i){ // var opid = new Array(); if($("#chk_"+$(this).attr("id").substr(9)).is(":checked")) { if ($("#pa_"+$(this).attr("id").substr(9)).val() == '') { //display error, alert("If you have selected to submit a PO you must give it a weighting"); var error = 1; } else { alert($(this).attr("id").substr(9)+" "+$(this).val()+" "+$("#pa_"+ $(this).attr("id").substr(9)).val()) opid[i]['opid'] = $(this).attr("id").substr(9); alert(opid[i]['opid']); } } else { // alert("not selected"); } i++ }); });