jquery获取$(this)下的子元素以及父元素
<div class="eg">
<div class="eg1">
<span>Hello!</span>
<p>Hi!</p>
</div>
</div>
$(".eg1").live("click", function () {
$(this).parent();//获取的是"div .eg"
$(this).children("span");//获取的是<span></span>元素
$(this.).find("p");//获取的是<p></p>元素
});
注意: 这里使用find()函数的时候是$(this)下面的元素
One of the best feeling in the world is when you walk among in the code lines!
"Build the boat, wait here where the water will be come! After that, you will be success!"
I trust my self , trust the technology, trust the beautiful tomorrow for me !