title: Focus input in Cordova web app
body: <p>Asked a question about this earlier. Have tried a new method, still doesn't work. I have a button that removes a <code>&lt;p&gt;</code> element and replaces it with a <code>&lt;textarea&gt;</code> with the same content, but editable. I need to tranfer focus to that <code>&lt;textarea&gt;</code>, but cannot on device, only on browser. I have added the requiered <code>&lt;preference name="KeyboardDisplayRequiersUserAction" value="false"/&gt;</code> propery to <code>config.xml</code>.</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;div ng-click="edit()"&gt;
    Click here to edit
  &lt;/div&gt;
  
  &lt;div ng-if="!post.typing" class="post-text"&gt;
    &lt;p&gt;{{post.post_text}}&lt;/p&gt;
  &lt;/div&gt;
  
  &lt;div ng-if="post.typing" class="post-text"&gt;
    &lt;form ng-submit="submit()"&gt;
      &lt;textarea id="text"  ng-keyup="$event.keyCode == 13 &amp;&amp; submit()" style="width:100%" ng-model="post.post_text"&gt;&lt;/textarea&gt;
      &lt;input type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/&gt;
    &lt;/form&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>JS:</p>
  
  <pre><code>$scope.edit = function() {
    $scope.post.typing = true;
    $timeout(function () {
      document.getElementById("text").focus();
    }, 100);
  }
  </code></pre>