@model HelloWorldMvcApp.SampleViewModel
<a href="http://stackoverflow.com/questions/43698162/select-for-select-c-sharp-to-javascript">
http://stackoverflow.com/questions/43698162/select-for-select-c-sharp-to-javascript
@foreach(var team in ViewBag.List)
<option value="@team.Key">@team.Key</option>
<select id="team"></select>
<script type="text/javascript">
//Complete list of leagues and their teams:
@foreach(var l in ViewBag.List)
foreach(var team in ViewBag.List[l.Key])
var selectLeague = document.querySelector('#league'),
selectTeam = document.querySelector('#team');
var league = selectLeague.value;
selectTeam.innerHTML = '';
leagues[league].forEach(function(team) {
var x = document.createElement("OPTION");
x.setAttribute("value", team);
selectTeam.appendChild(x);
selectLeague.onchange = updateTeams;