Getting the ID name

admin

Administrator
Staff member
I'm not sure if this can be done but what I want to do is compair the value I gave a div's id, with a variable. For instance, if I have the following tag,

<div id="test"> can I compair "test" with a variable I named earlier, something like this,

var testvar = "test";

if (testvar == "nameofidtag")
{
code here
}

Can this be done?? Note: if it can be done with name, etc. that should work for me as well. I tried the getElementsById, but that didn't seem to work. :(
 
Back
Top