[jQuery] Re: Toggling the html of an element

2007-08-29 Thread voltron
Cool! Thanks On Aug 28, 12:38 am, Dan Evans <[EMAIL PROTECTED]> wrote: > One reason why the others may not have worked is because .toggle() > assigns a click handler to an element. It is the same as > writing .click() except that it takes two functions instead of one and > it alternates them. So

[jQuery] Re: Toggling the html of an element

2007-08-27 Thread Dan Evans
One reason why the others may not have worked is because .toggle() assigns a click handler to an element. It is the same as writing .click() except that it takes two functions instead of one and it alternates them. So the original way it's written says, "When the user clicks this thing add a new c

[jQuery] Re: Toggling the html of an element

2007-08-27 Thread Olaf Bosch
voltron schrieb: 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: toggle is click, see: $('#toggleTwo').toggle(function(){ $('#rubricTwo').hide();

[jQuery] Re: Toggling the html of an element

2007-08-27 Thread voltron
thanks for the heads up Dan! I modified your code and it worked, you missed out the part that really hides and shows the element: $(document).ready(function(){ $('#toggleTwo').toggle(function(){ $('#toggleTwo').html('hide'); $('#rubricTwo').hide();

[jQuery] Re: Toggling the html of an element

2007-08-27 Thread Dan Evans
How about instead of putting a .toggle() inside a .click() just use a .toggle()? Something like this: $(document).ready(function(){ $('#toggleTwo').toggle(function(){ $('#rubricTwo').html('hide'); return false; }, function(){ $('#ru

[jQuery] Re: Toggling the html of an element

2007-08-27 Thread voltron
Very strange, that does nor work either Klaus. I am using 1.1.3, maybe it´s a Jquery version problem? Toggle works when I remove both arguments and leave it empty. Thanks On Aug 27, 9:56 pm, Klaus Hartl <[EMAIL PROTECTED]> wrote: > Benjamin Sterling wrote: > > > >$(document).ready(function(

[jQuery] Re: Toggling the html of an element

2007-08-27 Thread voltron
Thanks for the reply Benjamin, sadly, the solution does not work, strangely, FireBug does not state any errors. Any other idea? Thanks again On Aug 27, 8:54 pm, "Benjamin Sterling" <[EMAIL PROTECTED]> wrote: > >$(document).ready(function(){ > >$('#toggleTwo').click(function(){ > va

[jQuery] Re: Toggling the html of an element

2007-08-27 Thread voltron
Strange, my posts are not showing up. Well here goes. I tried both methods, and both don' t work, could it be a biug with the Jquery version? I am using 1.1.3. Firebug does not state any errors and when I remove both values for the toggle function, it works. Any other ideas? Thanks On Aug 27, 10

[jQuery] Re: Toggling the html of an element

2007-08-27 Thread Dan Evans
Is there a reason to put the .toggle() inside a .click()? Why not? $(document).ready(function(){ $('#toggleTwo').toggle(function(){ $('#rubricTwo').html('hide'); return false; }, function(){ $('#rubricTwo').html('show');

[jQuery] Re: Toggling the html of an element

2007-08-27 Thread Benjamin Sterling
Ahh good catch Klaus! On 8/27/07, Klaus Hartl <[EMAIL PROTECTED]> wrote: > > > Benjamin Sterling wrote: > > > >$(document).ready(function(){ > > > >$('#toggleTwo').click(function(){ > > var $this = $(this); // add a reference to "this" relating to the A tag > > $('#rubricTwo').to

[jQuery] Re: Toggling the html of an element

2007-08-27 Thread Klaus Hartl
Benjamin Sterling wrote: $(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

[jQuery] Re: Toggling the html of an element

2007-08-27 Thread Benjamin Sterling
$(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;