imperator
imperator

Reputation: 181

How to hide iPad keyboard in Safari + designMode=on

iOS5 now supports designMode=On. I set that on a document of an iframe and it works pretty well. Now I want to hide the onscreen keyboard with Javascript after clicking on an image inside that editable document (=iframedoc in my case). I tried iframedoc.blur(), iframedoc.activeElement.blur(),iframedoc.body.blur() or iframe.contentWindow.blur() and I also tried to set the focus to a hidden link or a submit button but it is not working for me.

For text input fields just blur seems to work but I have a designmode=on document so the solutions for this question are not working for me: iPad Safari - Make keyboard disappear

Upvotes: 1

Views: 1434

Answers (3)

Leon Gaban
Leon Gaban

Reputation: 39018

Here is a great solution found from this stack answer, I was stuck on this too.

Upvotes: 0

Loren Rosen
Loren Rosen

Reputation: 31

Call preventDefault() in the event handler for the 'touchstart' event.

Upvotes: 3

imperator
imperator

Reputation: 181

it seems that after hours I found a workaround: 1. set focus to another standard input field on screen so the keyboard is connected to that field 2. make a blur() of that field

this workaround is a bit complicated to handle because it scrolls the view to that other field. So that has to be solved as well like with a moving input field.

Upvotes: 1

Related Questions