How to implement a jQuery live bind event on mootools?

Though I'm not sure if it'll work with 1.11 Element. Implement({ addLiveEvent: function(event, selector, fn){ this. AddEvent(event, function(e){ var t = $(e.

Target); if (!t. Match(selector)) return false; fn. Apply(t, e); }.

BindWithEvent(this, selector, fn)); } }); $(document. Body). AddLiveEvent('click', 'a', function(e){ alert('This is a live event'); }).

Though I'm not sure if it'll work with 1.11. Element. Implement({ addLiveEvent: function(event, selector, fn){ this. AddEvent(event, function(e){ var t = $(e.

Target); if (!t. Match(selector)) return false; fn. Apply(t, e); }.

BindWithEvent(this, selector, fn)); } }); $(document. Body). AddLiveEvent('click', 'a', function(e){ alert('This is a live event'); }).

Under this code, the return false; blocks the default event (ie. Click) from firing if it doesn't match the selector. Suggest this modification: if (t.

Match(selector)) fn. Apply(t, e); though still not ideal as an extra event with no effect gets bound to the elements unnecessarily. – Brian Hogg Aug 8 at 22:21.

Anomareh is on the right track. You would also want to check the ancestor elements of the event target. I'm not sure if this works with all events since some of them do not bubble (not sure how Mootools handles this).

I think document. Body is the whole document, no? – Thorpe Obazee Mar 5 '10 at 1:43 That is true but irrelevant because anomareh's code only checks if the event target matches the selector, whereas jQuery's live() also checks ancestors of the event target.

– Sean Hogan Mar 12 '10 at 11:51.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions