4 ms·
Is there an equivalent to `this.onkeyup` for touch devices that don't generate onkeyup events? Trying to make this work on an iPad, but I only have surface know
by shurcooL 14y ago
Is there an equivalent to `this.onkeyup` for touch devices that don't generate onkeyup events? Trying to make this work on an iPad, but I only have surface knowledge of JS.
- Cushman 14y agoHmm... I only have an iPad simulator with me, but it works just pasting in what I wrote above. Maybe something in your data URI is getting munged? Keyup is used here rather than keypress (which fires only once for each down-up event) since backspace won't fire keypress events, which is a nice thing to have in a live environment. But I can't think of any environment which would implement keypress and not keyup, or how one might work around not having key events at all. I did, however, discover that if you alert in mobile Safari (in simulation and on my iPhone) on a backspace keydown, the keyup never gets through and it will happily erase everything before the cursor.
- shurcooL 14y agoYou're right, it works fine with onkeyup. I tried pasting the URL directly instead of opening from "other devices" and it worked. Thanks.
- infinity 14y agoMaybe this helps you, there is a W3 document about touch events: http://www.w3.org/TR/touch-events/ http://www.w3.org/TR/touch-events/ A list of TouchEvent types is here: http://www.w3.org/TR/touch-events/#list-of-touchevent-types http://www.w3.org/TR/touch-events/#list-of-touchevent-types Here is a document from Apple about touch events: http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/HandlingEvents/HandlingEvents.html http://developer.apple.com/library/safari/#documentation/app... And a list of events supported by the Safari browser: http://developer.apple.com/library/safari/#documentation/appleapplications/reference/safariwebcontent/HandlingEvents/HandlingEvents.html#//apple_ref/doc/uid/TP40006511-SW5 http://developer.apple.com/library/safari/#documentation/app... I don't have an iPad, but I would love to know, if you could successfully use one of these events in this context. Edit: For example, orientationchange looks promising. Type something, then change orientation.
- Deestan 14y agoIt's pretty brutal and stupid, but: window.setInterval(function(){eval(this.innerText)},1000);