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

Categories

0 votes
494 views
in Technique[技术] by (71.8m points)

html - iPhone keyboard in UIWebView does not go away

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

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

1 Answer

0 votes
by (71.8m points)

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...