jQuery Mobile suggests to use tap events instead of click events, as click adds a delay.
So if I have:
<a id="someID" href="#" onclick="someFunction(); return false">asd </a>
how do I change this to inline tapping event?
I could do this:
$('#someID').live('tap',function(event) { ... });
but don't want to have ID's in my scripts, so prefer to call a function inline
Would you like this solution?
HTML:
<div ontap="test()">TAP ME</div>
SCRIPT:
$('[ontap]').each(function(){
$(this).on("tap", new Function($(this).attr("ontap")));
});
There is no "inline tapping event" like, ontap="someFunction()", as tap is a jQuery Mobile construct.
Excerpt from jQuery Mobile Source (notice the 'tap' event):
// add new event shortcuts
$.each(("touchstart touchmove touchend orientationchange throttledresize " +
"tap taphold swipe swipeleft swiperight scrollstart scrollstop" )
.split( " " ),
function( i, name ) { ...
For more information:
http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.js
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With