Let's say I have an object with keys and values like
{
input_1: 'value_of_input_1',
input_2: 1,
input_3: 'two'
}
Then some input fields:
<input type="text" name="input_1">
<input type="checkbox" name="input_2">
<select name="input_3">
<option value="one"> One </option>
<option value="two"> Two </option>
<option value="three"> Three </option>
</select>
Is there some jQuery function that is able to copy the values from the object variable to the actual input fields? I mean set the correct values, check or uncheck checkboxes, select correct option etc...
I know about $.val()
but it only works for text fields?