0

i have an inline onclick="myFunction('various parameters to pass to the function')" on dynamically created elements that i would like to call on an hypothetical inline onswipe too. I was wondering if the jQuery .on('swipe' .. can be used inline like that? doing onswipe="myFunction()" or how can i achieve that otherwise? thanks

  • All built-in events have inline `onXXX` attributes. – Barmar Sep 07 '18 at 16:13
  • But why not use event delegation for all your dynamic elements? See https://stackoverflow.com/questions/203198/event-binding-on-dynamically-created-elements – Barmar Sep 07 '18 at 16:14
  • @Barmar is jquery's swipe built-in? –  Sep 07 '18 at 16:17
  • 1
    Apparently not. See https://developer.mozilla.org/en-US/docs/Web/Events#Touch_events for a list of touch events that are currently supported by browsers. – Barmar Sep 07 '18 at 16:22
  • @Barmar thanks seems like ontouchmove does the trick, now i have to understand how to customize it in terms of animation etc. i think you can post the above as an answer and i will mark as the solution –  Sep 07 '18 at 16:26

1 Answers1

1

The closest equivalent standard event is touchmove, so you can use ontouchmove="..."

Barmar
  • 741,623
  • 53
  • 500
  • 612