1
On my label appears all groups:
ABC
There should only be one group chosen by the dropdown, Example:
To
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 on the label.
The id that reaches the script is correct. " Grupoid"
– Simão Lopes