soyjavi/QuoJS — Issue #18: handling events on elements dynamically added to the DOM?
Author: oliverhr
Created: 2012-03-06 23:01:50+00:00
State: open

Hello,

I want to know if someone knows how or what is the way to handle events on elements dynamically added to the DOM?, since the next examples don't do.

```javascript
$$('.swipeme_right').swipeRight( function(event) {
$$(this).children('.bubble').toggleClass('hidden');
});

$$('.swipeme_right').bind('swipeRight', function(event) {
$$(this).children('.bubble').toggleClass('hidden');
});

$$('.swipeme_right').delegate('li', 'swipeRight', function(event) {
$$(this).children('.bubble').toggleClass('hidden');
});

$$('.swipeme_right').on('swipeRight', 'li', function() {
$$(this).children('.bubble').toggleClass('hidden');
});
```

All four examples do the same.

I think that it should be by using the delegate method() but does not, or maybe with the method on() like jquery 1.7 but neither does.

Thank you in advance.