[jQuery] Re: avoid inserting twice

2008-12-01 Thread ricardobeat
H. Something like $('#header').next(':not(#new)').prev().after('') ? 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

[jQuery] Re: avoid inserting twice

2008-12-01 Thread takeshin
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('test'); > > } > > or, logically, you wouldn't insert two elements with the same ID, so > you could simply use > if (!$('#new').

[jQuery] Re: avoid inserting twice

2008-11-30 Thread Mario Soto
As I understand you have the problem that some information you send via AJAX is been sended two, tree, etc. times because the user gets desperate and can't wait a couple of seconds. If that's you case, happened to me too. I solved with blockUI. I blocked, pages, or even part of a page (specificall

[jQuery] Re: avoid inserting twice

2008-11-30 Thread ricardobeat
And that can be shortened to: var h = $('#header'); if (!h.next(':not(#new)').length) { h.after('test'); } or, logically, you wouldn't insert two elements with the same ID, so you could simply use if (!$('#new').length) On Nov 29, 4:50 pm, seasoup <[EMAIL PROTECTED]> wrote: > or you can te

[jQuery] Re: avoid inserting twice

2008-11-29 Thread seasoup
or you can test inside the bind function: if ($('#header').next().('attr','id') != "new") { $('#header').after('tester'); } On Nov 29, 7:34 am, Dave Methvin <[EMAIL PROTECTED]> wrote: > Do you only want the button to work once? If that is the case, use .one > () instead of .bind().

[jQuery] Re: avoid inserting twice

2008-11-29 Thread Dave Methvin
Do you only want the button to work once? If that is the case, use .one () instead of .bind().