-1

value show in Is Cancelled = true but checkbox is not check . Can any one tell how to get write code when true then checkbox checked if false then unchecked. This code is not working .

function POGetby(PO_ID) {

            $.ajax({
                url: "/Home/POMain_Select",
                type: "GET",
                contentType: "application/json;charset=UTF-8",
                data: { 'PO_ID': PO_ID },
                dataType: "json",
                success: function (result) {

                    if (!$("#IsUCancelled").is(":checked")) {
                        $('#IsUCancelled').val(result.IsCancelled);
                    }

                    $('#UpdateModel').modal('show');
                    $('#UpdatePO').show();
                },
                error: function (errormessage) {
                    alert(errormessage.responseText);
                }
            });
            return false;
        }
  • 1
    $('#IsUCancelled').prop('checked',result.IsCancelled); hope #IsUCancelled is your checkbox id – charan kumar Oct 01 '18 at 12:21
  • Possible duplicate of [Setting "checked" for a checkbox with jQuery?](https://stackoverflow.com/questions/426258/setting-checked-for-a-checkbox-with-jquery) – AmirNorouzpour Oct 01 '18 at 12:23

1 Answers1

0
$('#IsUCancelled').prop('checked', result.IsCancelled);
AmirNorouzpour
  • 1,119
  • 1
  • 11
  • 26