I would like some help, wanted to make an IF to disable or enable a field that comes with a value of 1 or 0.
$(document).ready(function () {
$("#btnProduto").click(function () {
$.ajax({
type: "POST",
url: "Selecionar",
data: { id_produto: $("#ListaProdutos").val() },
success: function (mensagem) {
//alert(mensaje);
//$("#idproducto").val(mensaje.Nombre);
$(mensagem).each(function (index, item) {
//recibir datos json
$("#descricao").val(item.descricao),
$("#id_produto").val(item.id_produto)
$("#pvenda").val(item.pvenda)
});
}
});
});
});
My field I want to block or unblock is $("#pvenda").val(item.pvenda)
, this field will only return me 2 values, 1 or 0, if it is 0 I want to disable the field so the user does not edit it, and if it is 1 I want that the field is enabled for the user informs the value you want.
Thank you!