我希望在點擊按鈕時顯示每個「p」元素。但它不是沒用,請幫忙。foreach with jquery元素
<script>
$(document).ready(function(){
$("p").hide();
$("button").click(function(){
$('p').each(function() {
//alert($(this).text());
var abc = $(this).text();
abc.next().show();
});
});
});
</script>
<button>Toggle</button>
<p>Hello</p>
<p>Good morning</p>
<p>Good after noon</p>
<p>Good evening</p>
<p>Good night</p>
<div></div>
我想1個p元素,顯示HTML和CSS點擊一下 – ktm
@sagarmatha好吧,我更新了我的答案。 –
感謝您的回答 – ktm