[jQuery] Re: Div Changer Using Hide And Show

2008-02-22 Thread Charles Stuart
This is quite generalized and is bookmarkable... - http://enure.net/dev/hide-all-except-one/ On Fri, Feb 22, 2008 at 6:50 AM, J Moore <[EMAIL PROTECTED]> wrote: > > > good tips so far. > > I just wanted to add that using classes and ids works well. > > show blackbook > show redbook > > bla

[jQuery] Re: Div Changer Using Hide And Show

2008-02-22 Thread J Moore
good tips so far. I just wanted to add that using classes and ids works well. show blackbook show redbook blackbook stuff... redbook stuff... This makes your click function simpler. $('a.show').click(function(){ hide_divs(); var x = $(this).attr('id'); $('#'+ x + '-content').show

[jQuery] Re: Div Changer Using Hide And Show

2008-02-22 Thread Chris J. Lee
you could use $.delegate http://www.danwebb.net/2008/2/8/event-delegation-made-easy-in-jquery I haven't used it yet but it looks like life has just gotten easier. On Feb 21, 5:03 pm, Sientz <[EMAIL PROTECTED]> wrote: > I created this script to hide and show divs on a web page I am working > on

[jQuery] Re: Div Changer Using Hide And Show

2008-02-22 Thread andrea varnier
On 21 Feb, 23:03, Sientz <[EMAIL PROTECTED]> wrote: > $('a#blackbook').click(function() { > //HIDE DIVS > hide_divs(); > //SHOW LISTED DIV > $('.blackbook').show('fast'); > return false; > }); you see you got all these functions that basically do the same thing. if an anch