The problem here is that neither of your expressions can EVER evaluate
to false. Even if no actual DOM element is selected, you still get an
empty (jQuery)array.

On Aug 19, 4:34 am, andrea varnier <[EMAIL PROTECTED]> wrote:
> Hi :)
> in your plugins (I'm studying from the best here :))) I often find
> variable assignments like this:
>
>     options = $.extend({
>         url:  this.attr('action') || window.location.toString(),
>         type: this.attr('method') || 'GET'
>     }, options || {});
>
> it's like url = this OR that. right?
> then I try, for example:
>
>     var $sel = $('.left_selected') || $('.right_selected');
>
> meaning $sel = $('.left_selected') but if you don't find any element
> with that class, $sel = $('.right_selected').
> but this WON'T work :|
> where is my mistake? at first I thought those declarations were just a
> matter of true or false, but the example I reported above (taken from
> alsup's form plugin) is clearly something more interesting!
> can anyone help me please?
> thank you
> andrea

Reply via email to