Thanx for the help folks, live() works..! used mouseover and mouseout in place of hover..
~niraj On Apr 1, 9:46 am, niraj <[email protected]> wrote: > Thanx Folks, > > This is what i do. I delete the li, and as expected, the events > attached to this deleted li would be > deleted. But before i delete this li, i get the src (which is the jpg > image), construct a fresh li and everything inside it and append() at > the back of the 'ul'. Only after this i remove() the li which is out > of the view. That way my count of li's remains same and whats out of > the view is removed. But even a fresh attachment of a new li at the > back doesnt enable the events on it. I can see that events are still > active on non-removed li (originally added li's). The events are > attached to a class not id. > > Also, the 'detach' method mentioned above -> even if i used it, wont i > still have to use remove() to remove the li; else the li's going out > of the view will remain there. > > I tried bind() but as the description of bind() says, it needs to be > used for all future added elements. This too i did; using bind() just > before adding a new li; but it didnt work. I will try live() and post > the results soon. > > thanx again for the help.. > ~niraj > > On Mar 30, 11:30 pm, Pat Nakajima <[email protected]> wrote: > > > > > This sounds like a good candidate for event delegation. I believe that > > jQuery.fn.live implements this for bubbling DOM > > events:http://docs.jquery.com/Events/live#typefn. > > > On Mon, Mar 30, 2009 at 9:04 AM, Már Örlygsson > > <[email protected]>wrote: > > > > > I believe this is a bug. Is there a workaround/fix tet? > > > > It's intended as a feature. > > > Most jQuery newcomers must find out the hard way that .remove() is > > > really more like a "destroy" or "delete" method. > > > If you .remove() an element you're signalling that you don't intend to > > > use it again. > > > > Fortunately there seems to be a "detach" method on the jQuery > > > development road map (http://docs.jquery.com/JQuery_1.4_Roadmap#DOM) > > > which will do what you need. > > > > Until then you'll need to roll your own.. > > > > jQuery.fn.detach = function(){ > > > return this.each(function(){ this.parentNode.removeChild(this); }); > > > } > > > > -- > > > Már- Hide quoted text - > > > - Show quoted text -- Hide quoted text - > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en -~----------~----~----~----~------~----~------~--~---
