Can you show / hide iPad Safari keyboard using JavaScript?

Can I control the display, that is (show / hide) the keyboard in iPad Safari through code?

I have 2 form fields; 1. Text field (for example, name) 2. Select a list / drop-down menu (user status)

My question is when the user moves the focus from the name to the state, the keyboard is still there. Why is this and how can I hide the keyboard when the focus moves to the drop-down menu?

Thank.

+5
source share
2 answers

I ran into a very similar problem, not sure if my solution will work for you.

. e.preventDefault(), . , .

, input.blur() . , .

, !

+2

. , , ( ipad) .

<input type="hidden" id="blurInput" />

javascript :

$element = $(event.target);
if($element.is('select')) {
    $('#blurInput').blur();
    $element.focus();
}

, , ,

document.activeElement.blur();
$('input').blur();
+1

All Articles