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
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't much you can do with that since you can't conditionally
$('#no-defs')[$('.def').length==0?'show':'hide']();
On Apr 16, 1:54 pm, MorningZ morni...@gmail.com 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
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
$('#no-defs')[$('.def').length==0?'show':'hide']();
On Apr
-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
From: michaell...@gmail.com
To: jquery-en@googlegroups.com
$('#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 michaell...@gmail.com wrote:
$('#no-defs')[$('.def').length==0?'show':'hide']();
On
'
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?'show':'hide']();
On Apr 16, 1:54 pm, MorningZ morni...@gmail.com wrote:
There isn't much you
[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 'hide' and 'show'
strings?
Date: Thu, 16 Apr 2009 14:08
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 morni...@gmail.com wrote:
There isn't much you can do with that since you can't conditionally
code in .show or .hide unless you made a
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 code
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 li...@commadelimited.com wrote:
I'd be careful with code like that. It is terse, and very elegant
11 matches
Mail list logo