我想在點擊時隱藏具有班級「.close」的元素的父母。詳細信息:如果用戶點擊類「close」的元素,我想要隱藏單擊元素的父容器。如何隱藏特定兒童班的父母
所以我試着說一句:
$(this).(".close").click(function() {
$(this).parent.addClass("hide");
location.hash = "#hidden";
});
其中.hide是
.hide{
display:none;
}
但是,這不奏效。那麼我還會怎樣觸發呢?
你試過'$(本).parent()addClass( 「隱藏」);'' –
parent.addClass( '隱藏'。 )'應該是'parent()。addClass('hide')'。關閉作爲一個錯字 –
這是什麼'$(this)。(「。close」)'應該做的? – Titus