Basically, I have a bunch of input rows, each with id in the form
of something like.. item:characteristics:age or item:setting:type1:blah. It's kind of like going down folders to get to the item I want. So as you can see in the code, I am splitting each id and trying to rebuild it in the form item[characteristics][age] then set it to the value of the input field. This is modifying the properties of the item. We already have the item object passed into my code and i'm simply modifying the properties to the new values from the user's input.
Does anyone know how I can do this without eval?
I'm mainly using it because the variable name can't be hard coded, it is dynamic.
Here's the code I have so far.
jQuery('#debugWidget .edit').each(function() {
var id = "";
var ids = this.id.split(':');
for (i in ids) {
if(i==0) {
id += ids[i];
continue;
}
id += "['"+ids[i]+"']";
}
eval(id+" = '"+jQuery(this).val()+"';");
Thanks JS gurus.