You need to identify the Finish button on the iOS editing keyboard using javascript

enter image description here

From the image, is it possible to identify the iOS Finish button click event using javascript / jQuery? IOS keyboard click events can identify the use of the onkeypress function for the text area.

+2
source share
1 answer

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).

+1
source

Source: https://habr.com/ru/post/1204069/


All Articles