Is there a reason to put the .toggle() inside a .click()?
Why not?
<script type="text/javascript">
$(document).ready(function(){

        $('#toggleTwo').toggle(function(){
                $('#rubricTwo').html('hide');
                return false;
        }, function(){
                $('#rubricTwo').html('show');
                return false;
        });

}); // end document.ready
</script>

- Dan

On Aug 27, 11:54 am, "Benjamin Sterling"
<[EMAIL PROTECTED]> wrote:
> <script type="text/javascript">
>    $(document).ready(function(){
>
>        $('#toggleTwo').click(function(){
> var $this = $(this); //  add a reference to "this" relating to the A tag
> $('#rubricTwo').toggle(function(){
> $this.html = "hide";} ,function(){$this.html ="show";}
>                );// end toggle
>            return false;
>            });
>   }); // end document.ready
> </script>
>
> "this" in "$(this).html" was referring to the div you were toggling
>
> On 8/27/07, voltron <[EMAIL PROTECTED]> wrote:
>
>
>
>
>
> > Hi all,
>
> > I am toggling an element using A tags, I would like the A tag to
> > display "Show" or "Hide" depending on the state. my proble is, I
> > cannot get this to work properly:
>
> > my code:
>
> > <script type="text/javascript">
> >     $(document).ready(function(){
>
> >         $('#toggleTwo').click(function(){
> >             $('#rubricTwo').toggle(function(){
> >                $(this).html = "hide";} ,function(){$(this).html =
> > "show";}
> >                 );// end toggle
> >             return false;
> >             });
> >    }); // end document.ready
> > </script>
>
> > # ====== HTML
>
> > <a href="" id="toggleTwo">hide</a>
>
> > <div id="rubricTwo"> blah blah</div>
>
> > Any ideas? Thanks!
>
> --
> Benjamin Sterlinghttp://www.KenzoMedia.comhttp://www.KenzoHosting.com

Reply via email to