HTML:
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<title></title>
</head>
<body>
<form action="" method="post">
<label>Select Fridge or Freezer</label>
<select name="FridgeFreezer">
<option value="Fridge 1">Fridge 1</option>
<option value="Fridge 2">Fridge 2</option>
<option value="Fridge 3">Fridge 3</option>
</select>
<label>Temperature °C</label>
<input type="number">
<label>Comments</label>
<textarea name="comments"></textarea>
<button type="button" name="button">Save</button>
</form>
</body>
</html>
Goal:
How can I select a value from the dropdown menu, for example, I have selected Fridge 1 from the menu, I then type some value in the Temperature °C and Comments box. Next select another value from drop down box as an example Fridge 2 and start a fresh input, but if I go back to Fridge 1 the data previously inputted to be visible.
What do I need to look into in terms of research? I am not sure where to look or what keywords to search.
changeevent for theselectelement, and at that point, store the values for the other fields in an array of objects that represent each option (something like{id: 'Fridge 1', temp: '2', comments: 'example'}) and then search the array for any values you should load for the new id.