I would like to replace a variable in an object, but without knowing the variable's key... eg.:
var parameters = new Object();
parameters.startregion = null;
parameters.fx_adultnum = 2;
... bit later
$adultnum.change(function(){ setParameters("fx_adultnum", $adultnum.val() );});
and the setParameters function (what is absolutely don't work :P
function setParameters(v, value){
console.log(parameters);
$.each(parameters, function(key, val) {
if (key == v) {
console.log(key);
console.log(val);
$(this).val(value); // <-- not works
}
});
console.log(parameters);
}
I would like to replace fx_adultnum's value to 4 for example.
Could you help in this for meh? Thanks much.