[jQuery] How can I populate my global array?
Hi,
I'm wondering if anyone can help. I am new to jquery and I am trying
to get the variable `opid` to populate from within the $("#"+userid+"
input:disabled").each() statement, so that I can use it immediately
after that statement within the click $("a.btn.submit").click()
function.
Sorry if that doesn't make sense... Any help would really be
appreciated.
Thanks......
var opid = new Array();
$("a.btn.submit").click(function(){
var userid = $(this).attr("id").substr(4);
$("#"+userid+" input:disabled").each(function(i){
if($("#chk_"+$(this).attr("id").substr(9)).is(":checked"))
{
if ($("#pa_"+$(this).attr("id").substr(9)).val() == '')
{
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
{
}
i++
});
});