I believe you are looking for the following syntax:
$(selector)[ (expr ? 'next' : 'before') ]().show();

--
Brandon Aaron

On Sun, Jan 18, 2009 at 9:12 PM, Ami <aminad...@gmail.com> wrote:

>
> Sorry about my grammar, English isn't my lang.
>
> I am trying to write code like that:
>        var expr=true,selector='div';
>        $(selector) (expr ? .next() : .before() ). show();
>
> But it's not JS syntax. So how can I do it?
>
> I know,that I can do it like that:
>        if (expr) $(selector)..before(),show() else
> $(selector).next().show()
>
>
> But I am trying to find a solution, that return a jQuery object.
>
> Thank you.
>
>

Reply via email to