[jQuery] Re: Shorten the JQuery code

2009-04-16 Thread Joseph Le Brech
4:19:50 -0700 > Subject: [jQuery] Re: Shorten the JQuery code > From: michaell...@gmail.com > To: jquery-en@googlegroups.com > > > Guess it depends on who the next guy is :) > > On Apr 16, 2:16 pm, "Andy Matthews" wrote: > > I'd be careful with code

[jQuery] Re: Shorten the JQuery code

2009-04-16 Thread Andy Matthews
Yep. I like it, and it's really nice...giving you more options. -Original Message- From: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On Behalf Of mkmanning Sent: Thursday, April 16, 2009 4:20 PM To: jQuery (English) Subject: [jQuery] Re: Shorten the JQuery

[jQuery] Re: Shorten the JQuery code

2009-04-16 Thread Ricardo
That's already in the core :) $('#no-defs').toggle( !$('.def').length ); http://docs.jquery.com/Effects/toggle#switch - ricardo On Apr 16, 5:54 pm, MorningZ wrote: > There isn't much you can do with that since you can't conditionally > code in ".show" or ".hide" unless you made a plugin to pa

[jQuery] Re: Shorten the JQuery code

2009-04-16 Thread mkmanning
: jquery-en@googlegroups.com [mailto:jquery...@googlegroups.com] On > Behalf Of Joseph Le Brech > Sent: Thursday, April 16, 2009 4:12 PM > To: jquery-en@googlegroups.com > Subject: [jQuery] Re: Shorten the JQuery code > > I'm impressed by the [] brackets, does that eval() the &

[jQuery] Re: Shorten the JQuery code

2009-04-16 Thread mkmanning
; and 'show' > strings? > > > > > Date: Thu, 16 Apr 2009 14:08:09 -0700 > > Subject: [jQuery] Re: Shorten the JQuery code > > From: michaell...@gmail.com > > To: jquery-en@googlegroups.com > > > $('#no-defs')[$('.def').length==0?'

[jQuery] Re: Shorten the JQuery code

2009-04-16 Thread MorningZ
$('#no-defs')[$('.def').length==0?'show':'hide'](); Whoa so $("...")["show"]() is equiv $("...").show() that kinda makes sense thinking about the way arrays work in JS.. slick On Apr 16, 5:08 pm, mkmanning wrote: > $('#no-defs')[$('.def').length==0?'show':'hide'](); > > On Apr 16, 1:54 p

[jQuery] Re: Shorten the JQuery code

2009-04-16 Thread Andy Matthews
2 PM To: jquery-en@googlegroups.com Subject: [jQuery] Re: Shorten the JQuery code I'm impressed by the [] brackets, does that eval() the 'hide' and 'show' strings? > Date: Thu, 16 Apr 2009 14:08:09 -0700 > Subject: [jQuery] Re: Shorten the JQuery code

[jQuery] Re: Shorten the JQuery code

2009-04-16 Thread Joseph Le Brech
I'm impressed by the [] brackets, does that eval() the 'hide' and 'show' strings? > Date: Thu, 16 Apr 2009 14:08:09 -0700 > Subject: [jQuery] Re: Shorten the JQuery code > From: michaell...@gmail.com > To: jquery-en@googlegroups.com > > >

[jQuery] Re: Shorten the JQuery code

2009-04-16 Thread mkmanning
$('#no-defs')[$('.def').length==0?'show':'hide'](); On Apr 16, 1:54 pm, MorningZ wrote: > There isn't much you can do with that since you can't conditionally > code in ".show" or ".hide" unless you made a plugin to pass in a true/ > false parameter and decide in the plugin, for instance > > $("#

[jQuery] Re: Shorten the JQuery code

2009-04-16 Thread Joseph Le Brech
or try ndfs=$('#no-defs');($('.def').length == 0) ? ndfs.show() : ndfs.hide(); > Date: Thu, 16 Apr 2009 13:54:07 -0700 > Subject: [jQuery] Re: Shorten the JQuery code > From: morni...@gmail.com > To: jquery-en@googlegroups.com > > > There isn&#x

[jQuery] Re: Shorten the JQuery code

2009-04-16 Thread MorningZ
There isn't much you can do with that since you can't conditionally code in ".show" or ".hide" unless you made a plugin to pass in a true/ false parameter and decide in the plugin, for instance $("#no_defs").conditionalShow($('.def').length == 0); On Apr 16, 4:27 pm, Dragon-Fly999 wrote: > Co