I have a set of defined variables. I dynamically set a value to another variable that ends up being the name of one of the other defined variables. I want to do this so I know when on the page to use which of the set variables.
var mwm = "blah"
var vp = "bleh"
var am = "bluh"
var mwm720 = "some link 1"
var mwm717 = "some link 2"
var vp720 = "some link 3"
var vp717 = "some link 4"
...
Then I have some other scripts that run and, depending on conditions, sets a variable value to be the name of one of the other variables.
var myClass = $(this).attr("class").split(' ')[1];
var currDiv = "div." + myClass;
var currVersion = $(this).parent().attr("id");
var linkVers = myClass + currVersion;
The linkVers variable value always ends up being "mwm720", "mwm717", "vp720", etc. That's how I know when to use the mwmw720 or mwm717 (etc) variables.
Desired behavior
How do I get an alert/call to use the value of the variable name that is stored in the dynamic variable?
Let's say alert(linkVers); returns "mwm720". How do I get $(currDiv).html(linkVers); to insert the value of the mwm720 variable, (which would be "some link 1"), and not the name of the variable?
If there's a better method for trying to accomplish this behavior, I'll certainly entertain other solutions.
window[linkVers]variables[linkVers].