Asked a question about this earlier. Have tried a new method, still doesn't work. I have a button that removes a <p>
element and replaces it with a <textarea>
with the same content, but editable. I need to tranfer focus to that <textarea>
, but cannot on device, only on browser. I have added the requiered <preference name="KeyboardDisplayRequiersUserAction" value="false"/>
propery to config.xml
.
HTML:
<div ng-click="edit()">
Click here to edit
</div>
<div ng-if="!post.typing" class="post-text">
<p>{{post.post_text}}</p>
</div>
<div ng-if="post.typing" class="post-text">
<form ng-submit="submit()">
<textarea id="text" ng-keyup="$event.keyCode == 13 && submit()" style="width:100%" ng-model="post.post_text"></textarea>
<input type="submit" style="position: absolute; left: -9999px; width: 1px; height: 1px;"/>
</form>
</div>
JS:
$scope.edit = function() {
$scope.post.typing = true;
$timeout(function () {
document.getElementById("text").focus();
}, 100);
}
I note in your comment you included:
<preference name="KeyboardDisplayRequiersUserAction" value="false"/>
in config.xml. There is a typo in Requires - this may be your issue!
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.