When I try this.
 
$(document).ready(function() {                           
    $('dt.toggle').css("cursor","pointer").bind("click", function(){
    $(this).next('dd').slideToggle(800);
            });
            });
 
.the 'dd' displays initially in the open position, then closes onClick.
 
How do I need to change the code so that the 'dd' displays open first?
 
Thanks!
 
Rick
 
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On
Behalf Of Karl Swedberg
Sent: Tuesday, February 20, 2007 8:55 AM
To: jQuery Discussion.
Subject: Re: [jQuery] Hide/show question with dl/dt/dd - fixed!
 
On Feb 20, 2007, at 5:09 AM, Bruce MacKay wrote:
The other approach will work when the .parent('dt') is removed, thus:

$('dt.toggle').css("cursor","pointer").bind("click",
function(){$(this).next('dd').slideToggle(800);return false;});
 
btw, unlike with the <a>, you don't need a "return false" on clicking the
<dt>, because the <dt> doesn't have a default behavior. 



I guess the only remaining question is why does the bleeding obvious always
appear immediately after the send button on an email client is clicked!
 
Heh. When you find an answer, let me know, because it happens to me all the
time. :) 
 
 



Cheers,
--Karl
_________________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
 



 


Bruce




At 10:50 p.m. 20/02/2007, you wrote:


Hi folks,

I have a simple faq application with the question within a dt tag and the
corresponding answer within a dd tag.

I had hoped that my onload code of:

$('dt.toggle').bind("click",
function(){$(this).parent('dt').next('dd').slideToggle(500);return false;});

would have revealed the hidden answer until the question was clicked.

I tried wrapping the question in an a tag (with class=toggle) and the code:

$('a.toggle').bind("click",
function(){$(this).parent('dt').next('dd').slideToggle(500);return false;});

but this also proved wrong.

Clearly, I don't understand something here - would someone mind enlightening
me please?

Thanks,

Bruce

_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/
 
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/

Reply via email to