怎么来.parent()不工作?

TIM*_*MEX 0 javascript jquery

<div class="apple">
    <div class="abc">
       <input id="go">
    </div>
</div>


$("#go").click(function(){
    $(this).parent('.apple').hide(); // this doesn't work.
    $(this).parent().parent().hide(); //this works
});
Run Code Online (Sandbox Code Playgroud)

我想要.parent('.apple')工作.

Cro*_*zin 5

jQuery.parent()功能文档:

[...] .parents()和.parent()方法类似,只是后者只在DOM树上运行一个级别.[...]

换句话说,使用jQuery.parents()而不是jQuery.parent().