Hi Rich,

The reason that's not working is because the title paragraph is not the 
next() sibling. Its the prev(). So if you chance your code to use prev() 
instead of next(), it works great. I determined this using Firebug and 
examining what the answer object was being filled with. This why 
everyone loves Firebug so much. :)

Also you can try this as well:

$(document).ready(function() {

$("div.ann").find("p.title").hide().end().find("p.text").click(function()
  {
           if ($("p.title").is(':visible')) {
               $("p.title").slideUp();
           } else {
               $("p.title").slideDown();
           }
       });
  });

Rey...


Rick Faircloth wrote:
> Thanks for the explanation, Rey...
> 
> I've got another question for you about jQuery coding.
> 
> Do you see any reason why the following code wouldn't work?
> I've been working with it, but the text just sits on the page
> as if the Javascript is not active...
> 
> I'm trying to create dynamic
> announcements that are pulled from a database by CF,
> then the Title is displayed...on mouse click, the announcement
> text would slide down and become visible...
> 
> Rick
> 
> Here's the code:
> 
>  JQuery code:
> 
> $(document).ready(function() {
> 
> $("div.ann").find("p.title").hide().end().find("p.text").click(functio
>  n()
>  {
>           var answer = $(this).next();
>           if (answer.is(':visible')) {
>               answer.slideUp();
>           } else {
>               answer.slideDown();
>           }
>       });
>  });
> 
>  HTML:
> 
>  <div class="ann">
> 
>  <p class="title">
>  This is my title.
>  </p>
>  <p class="text">
>  This is my text.
>  </p>
> 
>  </div>
> 
> 
> 
> 
> 
> 
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
> Behalf Of Rey Bango
> Sent: Saturday, November 18, 2006 11:56 AM
> To: jQuery Discussion.
> Subject: Re: [jQuery] Firebug 1.0 coming soon
> 
> Hi Rick,
> 
> Firebug is a Firefox addon that dramatically helps your Javascript 
> development efforts. It helps you debug the code, inspect DOM values and 
> even view HTTP requests (critical for Ajax development). It has a ton 
> more functionality and is something that every web developer should be 
> using.
> 
> Even if the developer charged for it, I would buy it since its such a 
> HUGE help in my development efforts.
> 
> Rey...
> 
> Rick Faircloth wrote:
> 
>>What is "Firebug" and is there a preview of what it does somewhere online?
>>
>>Rick
>>
>>-----Original Message-----
>>From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
>>Behalf Of John Resig
>>Sent: Friday, November 17, 2006 11:59 PM
>>To: jQuery Discussion.
>>Subject: Re: [jQuery] Firebug 1.0 coming soon
>>
>>
>>>I'll take that as a 'no' then?
>>
>>Yeah, unfortunately. We have to keep it private until he wants to
>>release it (which may be for money, it sounds).
>>
>>--John
>>
>>_______________________________________________
>>jQuery mailing list
>>discuss@jquery.com
>>http://jquery.com/discuss/
>>
>>
>>
>>_______________________________________________
>>jQuery mailing list
>>discuss@jquery.com
>>http://jquery.com/discuss/
>>
> 
> 
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 
> 
> 
> _______________________________________________
> jQuery mailing list
> discuss@jquery.com
> http://jquery.com/discuss/
> 

_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/

Reply via email to