Unfortunately, adding "return false" to the link inside the "toggle" <div> doesn't stop the toggling. The "return false" just cancels the default behavior of the link (i.e. the href), but I need to cancel the default behavior of the parent "toggle" <div>. :\
On Sep 9, 6:45 pm, FrenchiINLA <[EMAIL PROTECTED]> wrote: > to make id simple i add an 'notoggle' id to your link you can use the > following code: > $('#toggle').click(function() { alert('toggle'); }); > $('#notoggle').click(function() { alert('No Toggle'); return > false; }); or if you don't want use id for the link $('#toggle a') > instead of $('#notoggle'). > <div id="toggle"> > Click here for more info > <a id="notoggle">do something</a> > </div> > > On Sep 9, 12:41 pm, jtibbetts <[EMAIL PROTECTED]> wrote: > > > How do you stop .toggle() from toggling an object when a link (or any > > object) inside the object is clicked. > > > Here's a quick contrived example: > > > <div id="toggle"> > > Click here for more info > > <a onClick="DoSomething();">do something</a> > > </div> > > <div id="info">blah blah blah...</div> > > > <script> > > $("#toggle").toggle( > > function () { > > $("#info").show(); > > }, > > function () { > > $("#info").hide(); > > } > > ); > > </script> > > > Clicking on the "toggle" <div> toggles the "info" <div>. If the "do > > something" link is clicked, the "toggle" <div> will toggle *and* > > DoSomething() will be called. I want to be able to click the "do > > something" link and only have DoSomething() trigger but not cause the > > <div> to toggle. Is this possible? > > > (Forgive the code if it's wrong, but I just whipped it up on the fly)