gpt4 book ai didi

javascript - 无法在 Cordova iOS 应用程序中添加自动完成功能

转载 作者:行者123 更新时间:2023-11-29 00:09:36 25 4
gpt4 key购买 nike

这是我的 html 代码,用于在 android cordova 项目中执行自动完成文本框,但它现在可以在 fiddle 中正常工作

    <!DOCTYPE html>

<html>
<head>

<meta name="format-detection" content="telephone=no">
<meta name="msapplication-tap-highlight" content="no">
<meta name="viewport" content="user-scalable=no, initial-scale=1, maximum-scale=1, minimum-scale=1, width=device-width">
<link rel="stylesheet" type="text/css" href="css/index.css">
<title>Trial App</title>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
$(document).ready(function() {

var aTags = ["Krishna", "Shubham", "Sachin", "Android", "Windows", "Himalaya", "Bahubali", "Win", "Game"];

$("#autocomplete").autocomplete({
source: aTags
});


$('#get_value').on('click', getval);

function getval() {

var value_inside = $("#autocomplete").val();
alert("Value inside text box is: " + value_inside);
}

});

</script>
<body>
<input type='text' title='Tags' id='autocomplete' />
<button id="get_value">get</button>
</body>
</html>

fiddle 的链接是:https://jsfiddle.net/krishlahoti/g83x5wLz/

在 fiddle 中,我使用了与上述 HTML 文件中相同的代码, fiddle 可以正常工作,但 cordova 应用程序没有。

附上屏幕截图和这个问题以使其更清楚 Refer this screenshot for the Cordova iOS

最佳答案

经过大量研究和同事的帮助,我终于实现了我的目标。

下面是根据问题需要工作的最终代码:

<!DOCTYPE html>
<html>
<head>

</head>

<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script
src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
crossorigin="anonymous"></script>
<script type="text/javascript">
$(document).ready(function() {

var aTags = ["Krishna", "Shubham", "Sachin", "Android", "Windows", "Himalaya", "Bahubali", "Win", "Game"];

$("#autocomplete").autocomplete({
source: aTags
});


$('#get_value').on('click', getval);

function getval() {

var value_inside = $("#autocomplete").val();
alert("Value inside text box is: " + value_inside);
}

});

</script>
<body>
<input type='text' title='Tags' id='autocomplete' />
<button id="get_value">get</button>
</body>
</html>

关于javascript - 无法在 Cordova iOS 应用程序中添加自动完成功能,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46903554/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com