Automatically creating a new dropdown list

Hey,
Im new into programming and try to use GOLang into my HTML website.
I created a dropdown list where it gets the data from a json file. After choosing I want that it will automatically creates a new dropdown list, but I can’t figure out how to do that. I couldn’t find information about this using GOLang, so thats why I will ask it here.

This is the code I used:

<form>
<select name="choice" style="font-size:18pt;height:40px;width:410px;" required>
<option value="">Make your choise</option>
{{range .}} <option value='1'>{{.Name}}<option>
{{end}}
</select>
<input type="submit">
</form>`

Do the second dropdown lists options depend on what was selected in the first one? Or is it always the same but it shouldn’t show before selected something in the first one?

The second dropdown list will be identical as the first one,
So as you said, it wouldn’t show before selecting something in the first one.

The easiest way to solve this is to put the second one inside a div which is hidden

<div id=“second” style=“display: none;”> … <div>

And then put a onchange event handler on the first dropdown list which changes display-style of the div. See this example:

https://www.w3schools.com/howto/howto_js_toggle_hide_show.asp

So this isn’t so much a go question as a html/css/javascript one

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.