Is there a way to capture the event in jquery/javascript when a user hits the "Return" key in the iphone browser keyboard? I'm trying to either hide the keyboard on the press or activate some function.
You could try this:
<script type="text/javascript">
document.onkeyup=function(e) {
if(e.which == 13){
$('inputID').blur();
//rest of function
return false;
}
}
</script>
Are you using a library?
Update
Depending on the application, an input submit would hide the keyboard and trigger a function:
<form id="searchForm" OnSubmit="doSearch(this.searchTerm.value); return false;">
<input type="search" name="searchTerm" autocorrect = "off" />
<input type="submit" value="Search" class="hidden" />
</form>
You could even hide the input button with CSS: .hidden {display: none;}
This is what hides the keyboard:
$('#inputID').blur();
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