Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

handling events on elements dynamically added to the DOM? #18

Closed
oliverhr opened this issue Mar 6, 2012 · 1 comment
Closed

handling events on elements dynamically added to the DOM? #18

oliverhr opened this issue Mar 6, 2012 · 1 comment

Comments

@oliverhr
Copy link
Contributor

oliverhr commented Mar 6, 2012

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.

$$('.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.

@vectorderivative
Copy link

Try using $$('selector').tap(function(){});

@soyjavi soyjavi closed this as completed Sep 25, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants