Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have an UIWebView that loads a HTML form.

When I select a text field the keyboard appears.

When I type and hit "Go" the form is submitted and the next page loads, but the keyboard does not go away, it stays on the screen.

The only way to get rid of the keyboard is to press the 'done' button on the keyboard or press the HTML submit button in the form.

Is it possible to make the keyboard disappear after hitting the Go button?

Thanks!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
475 views
Welcome To Ask or Share your Answers For Others

1 Answer

You need to have the active input resign the focus as the form submits. The easiest way would be to call .blur() on all your inputs in your form's onsubmit event handler

<form onsubmit="document.getElementById('myInput').blur();">
    <input type="text" id="myInput"/>
</form>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...