Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 添加(选项)在cordova ios项目中不起作用_Javascript_Jquery_Ios_Cordova - Fatal编程技术网

Javascript 添加(选项)在cordova ios项目中不起作用

Javascript 添加(选项)在cordova ios项目中不起作用,javascript,jquery,ios,cordova,Javascript,Jquery,Ios,Cordova,这是我的小提琴代码,我想在我的cordova应用程序中使用,但代码的执行在第行中断 列表2.添加(选项) 我无法理解这是为什么,因为它在safari浏览器上运行良好。 当在ios设备中启动safari的cordova应用程序时,ios用户web视图是否正确 choose: <input type="text" list="languages" id="input_box"> <label for="languages"> <datalist id="langua

这是我的小提琴代码,我想在我的
cordova
应用程序中使用,但代码的执行在第行中断

列表2.添加(选项)

我无法理解这是为什么,因为它在safari浏览器上运行良好。 当在
ios
设备中启动safari的
cordova
应用程序时,
ios
用户web视图是否正确

choose: <input type="text" list="languages" id="input_box">
<label for="languages">
  <datalist id="languages">
    <select id = "add_records">

    </select>
  </datalist>
</label>
<button onclick="abc();">get</button>
此外,我还包括了文件
datalist.polyfill.min.js
文件,该文件可在github上获得,网址为:

我还尝试了答案中建议的新应用程序

html代码如下所示:

<!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 src="http://code.jquery.com/ui/1.10.2/jquery-ui.js" ></script>

          <script type="text/javascript" src="js/jquery.js"></script>
        <script>

            $(document).ready(function() {

                              alert("Inside document ready")

                              var aTags = ["anuj", "all", "ball", "one", "blackberry", "zathura","friends", "game of thrones", "sport"];

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

                              $('#get').on('click', get);

                              function get() {
                              //alert("Inside getval();");
                              var val1 = $("#autocomplete").val();
                              alert("Value inside text box is: "+val1);
                              }

                              });
            </script>

    </head>
    <body>

            <h1>Trial App</h1>
            <input type='text' title='Tags' id='autocomplete' />

            <button id="get">get</button>

        <script type="text/javascript" src="cordova.js"></script>
        <script type="text/javascript" src="js/index.js"></script>
    </body>
</html>

试用应用程序
$(文档).ready(函数(){
警报(“内部文档准备就绪”)
var aTags=[“anuj”、“all”、“ball”、“one”、“blackberry”、“zathura”、“friends”、“game of thrones”、“sport”];
$(“#自动完成”)。自动完成({
资料来源:aTags
});
$('#get')。在('click',get');
函数get(){
//警报(“内部getval();”;
var val1=$(“#自动完成”).val();
警报(“文本框内的值为:“+val1”);
}
});
试用应用程序
得到
但是,附加一个应用程序的屏幕截图是行不通的

在$(document).ready()事件中添加代码

这是最新的小提琴

用加法

HTML

<input type='text' title='Tags' id='autocomplete' />
编辑1

只需使用jquery自动完成

这是你的电话号码

编辑2

更新了完整代码

下面是完整的html代码和js代码

<!DOCTYPE html>
<html>
<head>
    <title>autocomplete demo</title>
</head>
  <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/black-tie/jquery-ui.css">
  <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 = ["anuj", "all", "ball", "one", "blackberry", "zathura", "friends", "game of thrones", "sport"];

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


      $('#get').on('click', get);

      function get() {
        //alert("Inside getval();");
        var val1 = $("#autocomplete").val();
        alert("Value inside text box is: " + val1);
      }

    });

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

自动完成演示
$(文档).ready(函数(){
var aTags=[“anuj”、“all”、“ball”、“one”、“blackberry”、“zathura”、“friends”、“game of thrones”、“sport”];
$(“#自动完成”)。自动完成({
资料来源:aTags
});
$('#get')。在('click',get');
函数get(){
//警报(“内部getval();”;
var val1=$(“#自动完成”).val();
警报(“文本框内的值为:“+val1”);
}
});
得到
只需包含jquery-ui.js和jquery-ui.css。您可以稍后自定义css

希望这有帮助

在$(document).ready()事件中添加代码

这是最新的小提琴

用加法

HTML

<input type='text' title='Tags' id='autocomplete' />
编辑1

只需使用jquery自动完成

这是你的电话号码

编辑2

更新了完整代码

下面是完整的html代码和js代码

<!DOCTYPE html>
<html>
<head>
    <title>autocomplete demo</title>
</head>
  <link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/black-tie/jquery-ui.css">
  <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 = ["anuj", "all", "ball", "one", "blackberry", "zathura", "friends", "game of thrones", "sport"];

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


      $('#get').on('click', get);

      function get() {
        //alert("Inside getval();");
        var val1 = $("#autocomplete").val();
        alert("Value inside text box is: " + val1);
      }

    });

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

自动完成演示
$(文档).ready(函数(){
var aTags=[“anuj”、“all”、“ball”、“one”、“blackberry”、“zathura”、“friends”、“game of thrones”、“sport”];
$(“#自动完成”)。自动完成({
资料来源:aTags
});
$('#get')。在('click',get');
函数get(){
//警报(“内部getval();”;
var val1=$(“#自动完成”).val();
警报(“文本框内的值为:“+val1”);
}
});
得到
只需包含jquery-ui.js和jquery-ui.css。您可以稍后自定义css


希望这有帮助

JSFIDLE包含错误,您尝试过调试吗?@Anuj.T JSFIDLE包含什么类型的错误?是的,我尝试过在xcode中调试,但在list2.add(option)行执行失败。jsfiddle包含错误,您尝试过调试吗?@Anuj.T jsfiddle包含什么类型的错误?是的,我曾尝试在xcode中调试,但在list2.add(选项)行执行失败。尝试了上述解决方案,但它在android和windows平台上运行良好,但在iOS上运行不好,无法找出原因?safari浏览器不支持datalist标记。。这就是为什么它在ios中不起作用。那么现在你想要实现什么呢?因为我们必须找到除了datalist元素之外的其他方法。如果您包括文件datalist.polyfill.min.js,则datalist在safari中有效,该文件可在Github上获得,如问题中所述。问题中提到的提琴适用于safari浏览器,我只想在ios中实现自动完成功能,因为它在android和windows中使用datalist(除safari外的所有浏览器)实际上,你提到的js不支持更新的safari版本。它的自述文件提到它将在safari 6上工作……iPhone3GS有safari 6版……iPhone4有7.1版。所以我确信你正在测试最新的iphone。。。其中有最新版本的safari。。。因此,数据列表是多填充的。js不支持最新的safari版本。尝试了上述解决方案,但它适用于android和windows平台,但不适用于iOS,无法找出原因。safari浏览器不支持datalist标记。。这就是为什么它在ios中不起作用。那么现在你想要实现什么呢?因为我们必须找到除了datalist元素之外的其他方法。如果您包括文件datalist.polyfill.min.js,则datalist在safari中有效,该文件可在Github上获得,如问题中所述。问题中提到的提琴适用于safari浏览器,我只想在ios中实现自动完成功能,因为它在android和windows中使用datalist(除safari外的所有浏览器)实际上,你提到的js不支持更新的safari版本。它的自述文件提到它将在safari 6上工作……iPhone3GS有safari 6版……iPhone4有7.1版。所以我确信你正在测试最新的iphone。。。其中有最新版本的safari。。。因此,数据列表是多填充的。js do