This is what I'm trying to accomplish:
var result = document.getElementById("o_q1_op1");
document.getElementById("a1_op1").style.height = result.scrollHeight;
But I dont want to rewrite it a dozen times, instead want to use arrays structured like this:
var que = ["o_q1_op1", "o_q1_op2", "o_q2_op3"];
var ans = ["a1_op1","a1_op2","a1_op3","a1_op4"];
This is what I have so Far:
var que = ["o_q1_op1", "o_q1_op2", "o_q2_op3"];
var ans = ["a1_op1","a1_op2","a1_op3","a1_op4"];
var result;
var index;
var text = "";
for (index = 0; index < que.length; index++) {
text += que[index];
var result[index] = document.getElementById(text);
}
var index2;
var text2 = "";
for (index2 = 0; index2 < ans.length; index2++) {
text2 += ans[index2];
document.getElementById(text2).style.height = result[index].scrollHeight;
}
I'v never used 2 arrays to accomplish one task before so I'm not sure how to go about it.