【问题标题】:ASP Checkbox list inside hide/show div隐藏/显示 div 内的 ASP 复选框列表
【发布时间】:2015-12-10 05:17:51
【问题描述】:

我在一个 Div 中有一个 checkboxList。单击 H4 时 div 隐藏。但是在选择任何复选框项后单击 H4 时我无法隐藏该 div

请检查我使用过的以下代码

<div class="prod-filter-nav">
<h4>Category</h4>
<asp:CheckBoxList ID="CheckBoxList1"  runat="server" class="prod-list"  
AutoPostBack="True"   RepeatLayout="UnorderedList">
</asp:CheckBoxList>
</div>

此页面使用的Javascript:--

jQuery(document).ready(function($){
$('.prod-filter-nav h4').on('click', function(){
    $(this).toggleClass('closed').siblings('.prod-list').slideToggle(300);
})
});

提前致谢

【问题讨论】:

  • 你可以试试这样的:

标签: javascript jquery asp.net .net


【解决方案1】:

不要找到&lt;h4&gt; 中的sibling,只需找到next 元素即可。

$(function(e) {
    $('.prod-filter-nav h4').on('click', function() {
        $(this).toggleClass('closed').next().slideToggle(300);
    })
});

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-09-16
    • 1970-01-01
    • 1970-01-01
    • 2013-01-29
    • 1970-01-01
    • 2017-08-02
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多