[英]autocomplete ,autocorrect is not working in android 4.4 using cordova or javascript
[英]JavaScript not working in Cordova app on Android 4.4+
我使用Cordova和Intel XDK為Android構建了一個簡單的測試應用程序,它在Android 4.0、4.2、4.3的仿真器中可以完美運行,但是JavaScript代碼在Android 4.4、5.0、5.1、6.0、7.0中均不起作用。 有人可以幫助我了解問題在哪里嗎? 謝謝。 這是代碼:
<body>
<script>
function getText() {
document.getElementById('replace_text').innerHTML = 'A simple line';
}
</script>
<a href="#" onclick="getText()">Click here to replace text.</a>
<br />
<div id="replace_text">Here is the text to replace.</div>
</body>
您是否在MainActivity.java中添加了這一行?
view.getSettings().setJavaScriptEnabled(true);
編輯
jQuery。 您需要做的是下載jquery並鏈接到本地,並在其中添加腳本文件:
var getText = function () {
$('#replace_text').html('A simple line');
};
var init = function () {
$('#clickMeToDoSomething').on('click',getText)
};
$(document).ready(init());
然后將是您的HTML:
<body>
<a href="#" id="clickMeToDoSomething">Click here to replace text.</a>
<br/>
<div id="replace_text">Here is the text to replace.</div>
</body>
<script src="assets/js/jquery-3.2.0.min.js"></script>
<script src="assets/js/myScript.js"></script>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.