2

関連なし: このページの別のオブジェクトが ID 'XXXXXXX' を既に使用しています

ページにjQuery MultiselectListboxコントロールがあります。

jQuery(document).ready(function () {
    jQuery(function () {
        jQuery("#UCStyle1 select").multiselect({
                header: true,
                height: 175,
                minWidth: 240,
                size: 3,
                classes: '',
                checkAllText: 'Check all',
                uncheckAllText: 'Uncheck all',
                noneSelectedText: '0 Selected',
                selectedText: '# selected',
                selectedList: 0,
                show: null,
                hide: null,
                autoOpen: false,
                multiple: true,
                position: {},
                appendTo: "body"
        });
});

次のような div タグで何度も参照されています。

<tr>
    <td>
        Looking for:
    </td>
    <td colspan="3">
        <div id="UCStyle1">
            <asp:ListBox ID="MatchGender" SelectionMode="Multiple" runat="server">
            </asp:ListBox>
        </div>
    </td>
</tr>
<tr>
    <td>
        State:
    </td>
    <td colspan="3">
        <div id="UCStyle1">
            <asp:ListBox ID="sState" SelectionMode="Multiple" runat="server">
            </asp:ListBox>
        </div>
    </td>
</tr>

したがって、それらはその jQuery を参照する必要がありますが、それらは異なるコントロールです。

警告が表示されます:

このページの別のオブジェクトは、すでに ID 'ucstyle1' を使用しています

複数回。

その警告が表示されないように、これをクリーンアップする方法はありますか? IE ではページが完全に不安定に見える原因になっていると思いますが、Firefox は気にしていないようです。

4

1 に答える 1