[jQuery] Checking for the next element then hiding it.

[jQuery] Checking for the next element then hiding it.


Hi guys I want to do something like this. I want jQuery to hide the h3
objects when it detects that there are no p objects after it.
My newb attempt:
$('h3').next('p').hide();
But it does not seem to work.
<h3>Title</h3>

Paragraph


<h3>Title</h3>
<h3>Title</h3>

Paragraph


Any suggestions?