Tekerson Tekerson - 1 year ago 90
HTML Question

Submit form without loosing soft keyboard

I have been trying to find a similar post to this question within the forum with no success. I have a simple form composed by a textarea and a button to submit on a app using angularJS. It works fine. However, when I press submit I loose the focus of the textarea so the keyboard disappears, and when I press on the textarea shows off again. I would like to keep it visible even if I press submit.

Answer Source

You can try attaching a handler to focusout event and focus the textarea inside that handler.

If you want to focus back to textarea only when the button is clicked, you can attach the handler to your button's click event instead.

//This will prevent textarea from being focused out
//$("textarea").on("focus", function(e) {
//  $(this).focus();

$("button").on("click", function(e) {
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download