This is about a regular responsive website with a dictionary lookup feature. The page consists of an input text box and an adjoining submit button. Currently if you open the page in a mobile browser and tap on the text box, the soft keyboard fires up automatically which is desirable. What's not desirable though is that the keyboard stays up even after the user taps on the enter
key on the soft keyboard. I know there's got to be some method to change that. Does this situation calls for a special Android/iOS-specific library or something? Can I just add something to the button's onclick()
to make it happen? If so, what function can one use? Do note that the keyboard disappears fine when the on-page submit button is tapped...it's just the soft keyboard enter key that's not having an effect on itself even though it does successfully submits the form.
I have tried the following and failed:
function lookup_check(lookupterm){
close_kb();
$('#word').blur();
if(lookupterm != ""){ lookup_word(lookupterm); }
else{
var testing = $('#word');
testing.addClass('empty');
setTimeout(function(){ testing.removeClass('empty'); },500);
}
}
The HTML calling the above function goes:
<button class="btn btn-lg btn-primary lookup-submit" type="submit" id="lookup" onclick="lookup_check($('#word').val());" style="display: inline-block;">Lookup</button>
P.S.: Just so we're absolutely sure, this is a desktop website and not an app.
Update: The accepted answer on the thread proposed by @NovaLogic is already stated to not work consistently across all versions of Android. Besides, I am looking for some way to accomplish this on not just Android but also on iOS/Windows devices. So, no, this question is NOT a duplicate.