Krishna Lahoti
Krishna Lahoti

Reputation: 64

Unable to add autocomplete feature in Cordova iOS Application

Here is my html code for performing auto complete text box in android cordova project but it is now working where as in the fiddle it is working

    <!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>

the link of the fiddle is: https://jsfiddle.net/krishlahoti/g83x5wLz/

In the fiddle i have used the same code as in the above HTML file the fiddle is working as desired but the cordova app doesn't.

Attaching a screenshot along with this question to make it more clear Refer this screenshot for the Cordova iOS

Upvotes: 0

Views: 760

Answers (1)

Krishna Lahoti
Krishna Lahoti

Reputation: 64

Finally after a lot of research and help from my colleagues i could finally achieve to my goal.

Below is the final code that works as needed in the question:

<!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>

Upvotes: 1

Related Questions