1
I am trying to change the bool in the database to true or false, the toggle switch to change, depending on true or false.
<script>
$(document).ready(function () {
for (var i = 0; i < '@Model.Participantes.Count()'; i++) {
if ($('#Participantes_' + i + '__ID').val() == "true")
$(".botaoConfirmacao[data-rowindex='" + i + "']").prop('checked', true).change();
else
$(".botaoConfirmacao[data-rowindex='" + i + "']").prop('checked', false).change();
i++;
}
$('.botaoConfirmacao').change(function (event) {
event.preventDefault();
if ($(this).prop('checked')) {
$('#' + $(this).attr('id')).val('true');
}
else {
$('#' + $(this).attr('id')).val('false');
}
});
});
Using which plugin? Jquery Toggle switch? https://plugins.jquery.com/toggleswitch/ ?
– Aline
No, bootstrap toggle switch
– Jambismo k.