In my label all groups appear:
ABC
There should only be one group chosen by dropdown, Example:
A
JS:
$("#GrupoID").change(function () {
document.getElementById("grupoupdate").innerHTML = $("#GrupoID").text();
});
Label:
@Html.Label((string)@ViewBag.Letra, htmlAttributes: new { @class = "form-control", @for = "grupoupdate", @id="grupoupdate" })
Dropdown:
@Html.DropDownListFor(model => model.GrupoID, new SelectList(string.Empty, "GrupoID", "LetraGrupo"), "" , htmlAttributes: new { @class = "form-control" })
If you do document.getElementById("grupoupdate").innerHTML = $("#GrupoID").val();
, the correct Id appears in the label.