Hmmmm. Something like $('#header').next(':not(#new)').prev().after('<div id="test"></ div>') ?
That way you step forward to the next element, if #new is already there it will 'zero' the object, but you need some other element as a following sibling for it to work. But it's clumsier than a condition and wastes quite a few function calls. On Dec 1, 7:05 am, takeshin <[EMAIL PROTECTED]> wrote: > On 30 Lis, 18:30, ricardobeat <[EMAIL PROTECTED]> wrote: > > > And that can be shortened to: > > > var h = $('#header'); > > if (!h.next(':not(#new)').length) { > > h.after('<div id="new">test</div>'); > > > } > > > or, logically, you wouldn't insert two elements with the same ID, so > > you could simply use > > if (!$('#new').length) > > Thanks. > I was looking for some short notation, > because now I use conditions like seasoup’s. > I thought that maybe it is possible to do it in the chaining mood. > > -- > regards, > takeshin