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 <dragon-fly...@hotmail.com> wrote:
> Could someone tell me how to shorten the following code? Thanks.
>
>           if ($('.def').length == 0) {
>             $('#no-defs').show();
>           }
>           else {
>             $('#no-defs').hide();
>           }

Reply via email to