Undefined Values ​​for JQuery Flags

I have 3 checkboxes, but they appear as undefined in the warning window. Is there a trick to make them show value? I tried to put the value 1 in the input tag, but it still displays as undefined.

Ok, thanks .. Here is some code.

        else if (item.field == "admCustRptDly" && item.value == "1")
        {
          $('#admCustRptDly').attr('checked', true);
        }

        else if (item.field == "admCustRptSumm" && item.value == "1")
        {
          $('#admCustRptSumm').attr('checked', true);
        }

        else if (item.field == "admCustRptDtl" && item.value == "1")
        {
          $('#admCustRptDtl').attr('checked', true);
        }

<input type="checkbox" id="admCustRptDly" name="admCustRptDly" class="admChkbx">
<input type="checkbox" id="admCustRptSumm" name="admCustRptSumm" class="admChkbx">
<input type="checkbox" id="admCustRptDtl" name="admCustRptDtl" class="admChkbx">
+3
source share
3 answers

your jquery is disabled, this does not quite give the answer you expect, instead of checking if the checkbox is checked:

var checked = $("#admCustRptDtl:checked").val();

Also, the verified attribute will never be true, html is actually checked = "checked"

+2
source
 else if (item.field == "admCustRptDly" && item.value == "1")

, ? , "admCustRptDply". , . :

 var val = $("#admCustRptDly").val()

HTML value.

, :

var checked = $("#admCustRptDly").attr("checked")

:

$("#admCustRptDly").attr("checked","checked")
+2

Could you expand? Some sample code would be very helpful, maybe you just skipped the flag name when trying to use it.

+1
source

Source: https://habr.com/ru/post/1705855/


All Articles