I have been working on this template where I need to show the options (showing the list of companies using for loop) for selection.
<select id="company_id" name="company_id">
<option selected="selected">(없음)</option>
{% for company in company_list %}
<option value="{{company.id}}">
{{company.name}}
</option>
{% endfor %}
</select>
On the template it looks like this:
the actual template default option
Let's say I picked the 6th option (2nd from the bottom). I want the default option to be changed VISUALLY when I hide the dropdown, clicking somewhere else. However, the selected option does not show visually.
It goes back to that very first option
Strangely, however, when I click on the selection to view the dropdown list, I see that the one I clicked is selected, though it is vague.
The 6th option is colored whereas unselected ones are black
Is there any way to make it show the one selected? My user complains that it is very confusing to keeping seeing the first option only even after selecting something else.
One thing I tried is getting rid of 'selected="selected"' snippet like so:
<select id="company_id" name="company_id">
<option>(없음)</option>
{% for company in company_list %}
<option value="{{company.id}}">
{{company.name}}
</option>
{% endfor %}
</select>
However, it did not work out in the end.