I have a function that searches the database for an entity list and shows it in select. However, I need this same list to be shown in a checkbox where the user can select more than one option.
Showing this list of results in < input type="checkbox" name="" value="" id "" & gt ;?
How do I get the uploaded values checked?
Current JS assembles the list in a < Select & gt ;, I need to replace to check:
function CarregaEntrada() {
$.ajax({
url: "/Qualidade/Entidade/CarregaEntidade",
//data: { representante: representante },
async: false,
success: function (data) {
$("#entrada").empty();
$("#entrada").append('<option value="0" disabled selected hidden>Selecione...</option>');
$.each(data, function (i, element) {
$("#entrada").append('<option value=' + element.Id + '>' + element.Descricao + '</option>');
});
}
});
}
});
current html - (need to override select by check)
<div class="col-md-10">
<select class="form-control select2" id="entrada" name="entrada"></select>
</div>