Skip to content Skip to sidebar Skip to footer

How To Access An Element By Giving A Variable In Jsp Using Getelementbyid?

I have the following code: var id1='Times'+another_variable; alert(document.getElementById(id1).className); Basically, I need to pass a variable in the getElementById, how do i do

Solution 1:

I was doing a small mistake with the id name. It was not able to find the Id of the element. Once I corrected the id variable, it started working!

Sorry guys, for bothering!!!

Post a Comment for "How To Access An Element By Giving A Variable In Jsp Using Getelementbyid?"