从模态窗口隐藏带有jquery的div

时间:2016-01-06 20:18:21

标签: jquery html hide

我现在卡住了,因为我正试图隐藏一个div onclick。我可以在同一div中使用删除图标时隐藏div;但是,当我在打开模态窗口后尝试隐藏div时,它不起作用。请在下面找到我的代码:

<section class="images">
<div class="image-listing"><a href="individual.html">
<div class="image-mask"><img src="http://placehold.it/640x480"      alt="test image">
<div class="image-bar-top">
<div class="image-like"><img src="img/like_off.png"></div>
<div class="image-delete"><a href="#delete"><img src="img/delete.png">    </a></div>
</div>
<div class="image-bar-bottom">
<div class="image-bar-text"><div class="price"><b>$350,000</b> 4BD |    3BA</div><div class="notification"></div><div class="showing"><a   href="#show"><img src="img/show.png"></a></div>
    <div class="image-bar-details">Test | </div><div class="image=bar-   address">Address</div>
    </div>
</div>

</div>
</a>
</div>

<div class="image-listing"><a href="individual.html">
<div class="image-mask"><img src="http://placehold.it/640x480"  alt="test image">
<div class="image-bar-top">
<div class="image-like"><img src="img/like_off.png"></div>
<div class="image-delete"><a href="#delete"><img src="img/delete.png">   </a></div>
</div>
<div class="image-bar-bottom">
<div class="image-bar-text"><div class="price"><b>$350,000</b> 4BD |   3BA</div><div class="notification"></div><div class="showing"><a   href="#show"><img src="img/show.png"></a></div>
    <div class="image-bar-details">Test | </div><div class="image=bar- address">Address</div>
</div>
</div>

</div>
</a>
</div>
</section>

<div id="delete" class="modalDialog">
<div>
    <a href="#close" title="Close" class="close-delete">X</a>
    <section class="content-delete">
        <h1>are you sure?</h1>
        Delete This
        <ul>
            <li class="itemdelete">remove</li>
            <li><a href="#close">cancel</a></li>
        </ul>
    </section>
    </div>
</div>

我试过这个,但我无法让它发挥作用:

$('.images').on('click', '.itemdelete', function() {
$(this).closest('.image-listing').remove();
});

0 个答案:

没有答案