【问题标题】:How to select a child div on button click using Jquery如何使用 Jquery 在单击按钮时选择子 div
【发布时间】:2017-11-01 10:24:17
【问题描述】:

我想选择 'chat-box-frnd-cnt' div 来应用淡出,我尝试过使用:

$(".chat-box, html, body").on("click", '.submitchatnew', function(){
$(this).parent().next('.chat-box-frnd').find('.chat-box-frnd-cnt').fadeOut(500);
});

但它不起作用

HTML:

<div class="chat-box">
         <div id="consubmitchatnew">
            <input class="submitchatnew" type="submit" value="" />
            </div>
                        <div class="chat-box-frnd">
                        <div class="chat-box-frnd-img"></div>
                        <div class="chat-box-frnd-cnt">
                        <div class="cbf-cnt"><h4></h4></div></div>
                        <div class="chat-box-frnd-cpng"></div>
                        <div class="chat-box-frnd-nm"><h3></h3></div>
                        <div class="cb-frnd-divisor"></div>
                        </div>

</div>

【问题讨论】:

标签: jquery html jquery-selectors


【解决方案1】:

关注JQuery`s documentation

你应该使用$(".chat-box").children(".chat-box-frnd-cnt").fadeOut(500);

【讨论】:

    猜你喜欢
    • 2015-10-19
    • 2016-09-12
    • 1970-01-01
    • 2014-07-07
    • 1970-01-01
    • 2014-05-03
    • 2016-08-29
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多