[jQuery] Re: Trying to assign onClick to a link

2008-12-16 Thread Cam Spiers
$('a#link').click(function(event) { event.preventDefault(); $('div#bugDiv').slideToggle('slow'); }); You can do this as well. On Wed, Dec 17, 2008 at 3:26 AM, Matt wrote: > > Worked perfectly. Thanks Michael and Mike!! > > On Dec 16, 6:43 am, Michael Price wrote: > > Matt wr

[jQuery] Re: Trying to assign onClick to a link

2008-12-16 Thread Matt
Worked perfectly. Thanks Michael and Mike!! On Dec 16, 6:43 am, Michael Price wrote: > Matt wrote: > > Hi everyone, > > > I'm very new to jQuery and am trying to have a div toggle between > > hidden and shown using the slideToggle function. This is my code that > > I have in the head of my html:

[jQuery] Re: Trying to assign onClick to a link

2008-12-16 Thread Mike Alsup
> Hi Matt > I think the click handler will need wrapping in a function as well: > > $('a#link').click(function() { >         $('div#bugDiv').slideToggle('slow'); >         return false; > > }); Ah! Good catch, Michael!

[jQuery] Re: Trying to assign onClick to a link

2008-12-16 Thread Michael Price
Matt wrote: Hi everyone, I'm very new to jQuery and am trying to have a div toggle between hidden and shown using the slideToggle function. This is my code that I have in the head of my html: $(document).ready(function(){ $('a#link').click( $('div#bugDiv').slideToggle('

[jQuery] Re: Trying to assign onClick to a link

2008-12-16 Thread Mike Alsup
> $(document).ready(function(){ >         $('a#link').click( >                 $('div#bugDiv').slideToggle('slow') >                 ); > > }); > > Right now, the way it works, the bugdiv slides to hidden on load, as > though it's just executing the code as opposed to associating it as > the oncli