[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('div id=newtest/div'); } or, logically, you wouldn't insert two elements with the same ID, so you could simply use if

[jQuery] Re: avoid inserting twice

2008-12-01 Thread ricardobeat
H. 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

[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('div id=newtest/div'); } 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:

[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

[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().

[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('div id=newtester/div'); } 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().