1

ここで何を修正できるか教えてください。私は一見単純に見えるものに閉じ込められています。

JQuery 1.6.2 の使用:

CheckBoxList でチェックされた項目の VALUES の配列を返そうとしています。

Web の変更例を使用すると、次のようになります。これは、「on、on、on、on」の配列を返します (4 つのチェックボックスがすべてオンになっている場合)。

Shots.push($(this).prop('checked')) は「true、true...」を返します Shots.push($(this).attr('Value')) は「on、on...」を返します

            var Shots = [];

            $('#cblShots').find('input[type=checkbox]:checked').each(function () {
                Shots.push($(this).val());
            });

                if (Shots != "") {
                    $(Pnote).val(Shots.join(', '));
                } else {
                    updateTips("Please select at least one item");
                    return false;
                }


<asp:Panel ID="pnlAppointmentShotSelection" runat="server" style="display:none;">
    <label>Please select which shots you would like administered</label>
    <br /><br />
    <asp:CheckBoxList ID="cblShots" runat="server" CssClass="ShotList">
      <asp:ListItem Value="Flu">Flu</asp:ListItem>
      <asp:ListItem Value="B-12">B-12</asp:ListItem>
      <asp:ListItem Value="Pneumonia">Pneumonia</asp:ListItem>
      <asp:ListItem Value="TDAP">Tetanus-Diptheria-Pertusis (TDAP)</asp:ListItem>
    </asp:CheckBoxList>
   </asp:Panel>
4

1 に答える 1