title: PhoneGap/Cordova: how to prevent Android softkeyboard from hiding after clicking on "Go"?
body: <p>I am using HTML/JavaScript and PhoneGap/Cordova to develop a small Scattergories-like game in which users have to type words related to a topic.</p>
  
  <p>The app uses <a href="https://github.com/driftyco/ionic-plugins-keyboard" rel="nofollow noreferrer">Ionic keyboard plugin</a> to show the soft keyboard at the beginning of the round, and to hide it at the end. During the round, there is a simple form that reads the words and stores them upon submit:</p>
  
  <pre><code>&lt;form action="javascript:addWord();"&gt;
      &lt;input type="text" id="textbox_text" value="" /&gt;
      &lt;input type="submit" id="textbox_skip" value="" /&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>That after styling looks like this (showing soft keyboard):</p>
  
  <p><img src="https://i.stack.imgur.com/0NTBo.png" alt="text input, submit button, and keyboard"></p>
  
  <p>I am getting two different behaviors depending on how the form is submitted:</p>
  
  <ul>
  <li><p>When the form's submit button is clicked: the word in the textbox is submitted, the keyboard remains up, and the textbox is focused again. (<strong>the expected behavior</strong>, not hiding the keyboard at all).</p></li>
  <li><p>When the soft keyboard's "Go" button is clicked: the word in the textbox is submitted, the keyboard goes down, the textbox is focused again, and the keyboard goes back up. (creating an annoying flash).</p></li>
  </ul>
  
  <p><strong>How can I prevent the keyboard from hiding after pressing the "Go" button just using Cordova?</strong></p>
  
  <p>I have searched online and found <a href="https://groups.google.com/forum/#!topic/phonegap/EEwTtn-NCNo" rel="nofollow noreferrer">what seemed like</a> <a href="http://www.x-services.nl/control-soft-keyboard-on-android-2-2-device-in-phonegap-cordova-application/311" rel="nofollow noreferrer">good leads</a>, but none of them gave me the desired behavior (even when the functions were being called, the keyboard was still hiding then showing).</p>
  
  <p>Also tried "cheating the keyboard" by using a secondary (not visible) text input that was focused when clicking on "Go" (its keycode is 13, like 'enter'), to then focus the primary input text after the form was submitted. But no luck.</p>
  
  <p>Then I tried by listening to the <code>native.keyboardhide</code> event as specified in the keyboard plugin documentation, also no success:</p>
  
  <pre><code>window.addEventListener('native.keyboardhide', keyboardHideHandler);
  
  ...
  
  // I tried a function similar to this one for when the key pressed was "Go"
  function keyboardHideHandler(ev) {
      ev.preventDefault();
      ev.stopPropagation();
      return false;
  }
  </code></pre>
  
  <p>I tried Rami's suggestion, but the solution to <a href="https://stackoverflow.com/a/15457800/4224337">https://stackoverflow.com/a/15457800/4224337</a> didn't work either. The keyboard still goes down and up after clicking on "Go."</p>
  
  <hr>
  
  <p>So I guess my question can be divided in:</p>
  
  <ul>
  <li><p>What happens when clicking on "Go" that makes it behavior different? (maybe the problem is that I don't understand the keyboard's flow); and</p></li>
  <li><p>Is there a way of preventing the keyboard from hiding after clicking on "Go" using exclusively PhoneGap/Cordova (and any of their plugins)?</p></li>
  </ul>