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
- [jQuery] avoid inserting twice takeshin
- [jQuery] Re: avoid inserting twice Dave Methvin
- [jQuery] Re: avoid inserting twice seasoup
- [jQuery] Re: avoid inserting twice ricardobeat
- [jQuery] Re: avoid inserting twice takeshin
- [jQuery] Re: avoid inserting twice ricardobeat
- [jQuery] Re: avoid inserting twice Mario Soto