I would like each “p” element to show upon clicking the button. But it is not not working please help.
<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 Answer