The div isnt allways created by click .. its called by my method/function if and when i need it .. this is the trouble i am having ... At the moment ive got the method to check for a click (in my tests) and it finds the div (as you have put below - this was my first approach at it yesterday !!)... but it gets made by the function making it then immediatly removed by the remove handler function
// by now the element is built so observe the document Event.observe(document, 'click', removeErrorElement); }, removeErrorElement : function() { if($('errortooltip')) { // always locates because in my test i call it from a click $('errortooltip').remove(); // always removes because in my test i call it from a click //alert('Found Element'); // always alerts because in my test i call it from a click Event.stopObserving(document, 'click', removeErrorElement); // what i want to do here is stop observing the document for a click for that specific function and listen for everything else .. if this makes sense ! } .................... Thanks Alex ----- Original Message ----- From: "bflanagan" <flanag...@gsicommerce.com> To: "Prototype & script.aculo.us" <prototype-scriptaculous@googlegroups.com> Sent: Thursday, January 15, 2009 2:23 PM Subject: [Proto-Scripty] Re: Stoping observing > > Since your function is creating the div, you can put a conditional in > it to check for the existence of the div before attempting to add it. > > Event.observe(document,'click', function() { > if($('divYouJustAdded'){ > removeTheElementIJustAdded(); > } else { > addTheElement(); > } > } > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to prototype-scriptaculous+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~----------~----~----~----~------~----~------~--~---