I have many html-inputs and a very big object with lots of information.
Many of those inputs are directly linked to a specific string in the object. E.g.:
<input name="alpha_beta_gamma" type="input" val="newstring" />
and
obj = {
alpha: {
beta: {
gamma: 'oldString'
}
},
stuff2: {
whatever: {
weathertoday: 'rainy',
sun: false
},
phone: '1234567'
}
}
the checkbox field for the value "sun" would have the name "stuff2_whatever_sun" but the "phone" field the name "stuff2_phone" and the "gamma" input field the name "alpha_beta_gamma".
Hope you guys get me :)
...and I will use a jQuery focusout event:
$('input.specialClass').live('focusout', function(){
obj[whatevercomeshere] = $(this).val();
});