Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
496 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 Reply

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>

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...