Hi Mathew,
It looks like your attempt will hide the next p rather than the h3. A filter function is probably your best bet in this situation:
$('h3').filter(function() {return !$(this).next('p'); }) Hope that helps. --Karl ____________ Karl Swedberg www.englishrules.com www.learningjquery.com On Jun 6, 2008, at 4:25 AM, Mathew wrote:
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> <p>Paragraph</p> <h3>Title</h3> <h3>Title</h3> <p>Paragraph</p> Any suggestions?