0
 $(document).on('click', '.update', function() {
var user_id = $(this).attr("id");
$.ajax({
    url: "fetch_single.php",
    method: "POST",
    data: {
        user_id: user_id
    },
    dataType: "json",
    success: function(data) {
        $('#userModal').modal('show');
        $('#name').val(data.name);
        $('#status_id').val(data.status_id);
        $('#note').val(data.note);
        $('#note_tow').val(data.note_tow);
        $('#note2').val(data.note2);
        $('#note3').val(data.note3);
        $('#payment').val(data.payment);
        $('#ntg_no').val(data.ntg_no);
        $('.modal-title').text("تعديل الحالة");
        $('#user_id').val(user_id);
        $('#action').val("Edit");
        $('#operation').val("Edit");
            if ($("#note").val() !== '') {
        $("#note").prop("disabled", true);
          } else {
       $("#note").prop("disabled", false);
    }
    }
});
});

I want to disable and enable note field depend on note field value null or not null the problem when I put if condition the field note is cleared when updating any field.

1 Answer 1

1

the issue is solved replace disable to readonly

Not the answer you're looking for? Browse other questions tagged or ask your own question.