(If someone has a better title, go ahead)
I want to insert the value of a variable within a function's parameters.
Here's an example to show the issue. here's a sample of strElements
value: elements : "elm1,elm2"
var p_mode = "exact";
var strElements = "elements : ";
if (typeof elements != "undefined") {
strElements += elements + ',';
} else {
strElements = "";
}
tinyMCE.init({
mode: p_mode,
/* Magic here */
strElements
/* other params */
});
I tried doing an eval and it doesn't seem to work either.
eval('tinyMCE.init({
mode: '+p_mode+','
+strElements+'
/* other params */
});');