单击时隐藏元素父级

时间:2014-06-04 17:48:08

标签: jquery

我试图在点击时隐藏元素的父级,但我无法让它工作。我已经尝试了所有我在谷歌上找到的所有东西,并将其指向一个特定的元素,但无法让它工作......帮助!

HTML

<div class='delete'>
    <div class='deletePopup'>
        <p>Are you sure you want to delete this task?</p>
        <div class="notDelete">NO</div>
        <div class="yesDelete" id="deletetask1">YES</div>
    </div>
</div>

JS

$(".notDelete").bind( "click", function(){
      $(this).parent('div').hide();
});

0 个答案:

没有答案