change string to var name
I am passing a string that happens to be a div name to my JS function and in my JS there is a variable with the same name as the string. I want to access that variable based on the div name that is passed.
Code:
var findMe;
findMe = "Test, Test, Test, Test";
function getText(toGet)
{
alert(toGet.toString());
var toReturn = toGet.toString(); //This sets toReturn to "findMe" I want it to set it as the value of findMe
return toReturn;
}
/*
Xtrme XJ
"Vision without Action, Daydream
Action without Vision, Nightmare"
Japanese Proverb
*/
Bookmarks