+ 2
Can I use variables inside getelementbyid()?
Consider there is a div element with id "div_id" Let variable A = div_id. then is getElementById("div_id") equivalent to getElementById(A)?
2 ответов
+ 1
Hi Adnan
yes, variable needs to be a string
but you probably want to do something like this
getElementById("div_id"+a);
So you get div_id1, div_id2. etc
+ 1
thank you Mike