If this field is part of the form, Done raises the onsubmit event of the form.
One approach is to set the timeout that occurs for each onblur form element (which is sent) and cleared for each onfocus element.
A quick example in jQuery as an explanation:
var blurOccurred; $("input") .on("blur", function(evt) { blurOccurred = window.setTimeout(function() { alert('Done button clicked'); }, 10); }) .on("focus", function(evt) { window.clearTimeout(blurOccurred); });
Thus, pressing "done" is detected with a delay of 10 ms. And if it simply moves to the prev / next form field, then the full timeout will not be executed.
I hope you get started.
Edit: on iOS7 there is an event.relatedTarget property that is null when the done button is clicked - otherwise it is an input element in which focus is set. It can also be used to detect if a key is pressed (or the keyboard is closed).
zvona source share