Hello!
Through the function below:
success: function( tbl_permissao ) {
obj_permissao = tbl_permissao;
var permissoes = phpUnserialize(obj_permissao.permissoes);
console.log(permissoes);
$.each(permissoes, function (name, valor) {
var $el = $('[name="' + name + '"]'),
type = $el.attr('type');
switch (type) {
case 'checkbox':
$el.prop('checked', true);
break;
case 'radio':
$el.filter('[value="' + valor + '"]').attr('checked', 'checked');
break;
default:
$el.valor(valor);
}
});
obj_form();
ret = true
$('#modal_permissao').modal('show');
$('.modal-title').html('<i class="fa fa-lock "></i> Editar Permissão');
},
More accuracies in the line% var permissoes = phpUnserialize(obj_permissao.permissoes);
console.log(permissoes);
I now need Check / Check elements of type checkbox, whose valor
is equal to 1 .
Using the function below, all elements of the checkbox type are being marked, so can you help me with this and only check if value equals 1?
<input name="aCliente" type="checkbox" >
<input name="eCliente" type="checkbox" >
<input name="dCliente" type="checkbox" >
<input name="vCliente" type="checkbox" >