[Solved] How to use a variable inside a string


Use this code

document.getElementById("aaa:j_idt89:"+ i +":asd").innerHTML

Note the change I made inside. "+ i +" . You actually needed a String Concatenation.

So explaining the code.

when i = 1

"aaa:j_idt89:"+ i +":asd" = "aaa:j_idt89:"+ 1 +":asd" = "aaa:j_idt89:1:asd" = thats what you need

0

solved How to use a variable inside a string