I have a Cordova app running on iOS. I've implemented a search box with this html:
<form>
<input type="search" class="historySearchTextbox" id="myFilter" placeholder="Search" spellcheck="false" autocorrect="off">
</form>
This works fine and gives me a 'Go' button instead of return on the popup keyboard. I can capture taps on the Go button with this javascript:
$('#myFilter').on('keyup', function (e) {
var theEvent = e || window.event,
keyPressed = theEvent.keyCode || theEvent.which;
if (keyPressed === 13) {
filter();
document.activeElement.blur();
}
return true;
});
But I still have the 'done' button to deal with on the keyboard. I believe there is no keycode that I can use, and my own testing agrees. Based on reading answers on stack overflow, the best I can do is detect when the keyboard goes away. I'm using this javascript:
$("#myFilter").bind('blur', function (event) {
window.alert("blur");
});
This works but I'd rather have a direct way of detecting a 'done' key tap.
Any suggestions?
Thanks!
Jon