我想弄清楚如何選擇一個特定的元素與它的父div,在點擊事件後的特定元素。如何選擇只有在家庭內的div後點擊
<div id="news">
<div class="one">
<p>news</p>
</div>
<div class="two">
<a href="#" class="clickme"></a>
</div>
</div>
<div id="users">
<div class="one">
<p>users</p>
</div>
<div class="two">
<a href="#" class="clickme"></a>
</div>
</div>
我簡單的jQuery如下:
$(".clickme").on("click", function() {
//how to select only the element with the class "one" within the parent and show it
});
我失敗的嘗試一直在嘗試使用父母和最接近的方法和代碼像$(this).parents().find(".one").show();
任何幫助將是巨大的!
瞧!我正在腦中凍結這一點。謝謝!! –
歡迎我添加演示 –