I am working with qualtrics and I am trying to customize their matrix control. I am trying to loop through a matrix with 8 rows and 4 columns where each cell contains a textbox and assign each textbox an onkeyup event like so:
for (var j=1; j< 9; j++){
row_txt[j] = [];
for (var k=1; k<5; k++){
txt1= $('QR~QID2~'+j+'~'+k);
txt1.onkeyup=function(){alert(j+','+k);};
}
}
However, the onkeyup event returns "9,5" for each textbox changed. Why isn't it displaying the correct indices? How can I assign the same onkeyup event to multiple objects with the corresponding parameters j and k ?
Thank you