How to use autocomplete in jquery

Total Post:36

Points:260
JQuery 
 972  View(s)
Ratings:
Rate this:
I want to use jquery autocomplete search box in my project . Please help me by giving a demo .
  1. Post:281

    Points:2003
    Re: How to use autocomplete in jquery

    This is a jQuery method used in modern websites to provide the user with a list of suggestions for the beginning of the word he has typed in a text box. The user can then select an item from the list, which will be displayed in the input field. This feature prevents the user from having to enter an entire word.

    jQueryUI provides an autocomplete widget—a control that acts a lot like a <select> dropdown, but filters the choices to present only those that match what the user is typing into a control. jQueryUI provides the autocomplete() method to create a list of suggestions below the input field and adds new CSS classes to the elements concerned to give them the appropriate style

    Syntax

    <link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
    <script src="https://code.jquery.com/jquery-1.12.4.js"></script>
    <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
    
    <div class="ui-widget">
        <label for="tags">Search: </label>
        <input id="tags">
    </div>
    <script>
        $(function () {
            var SearchData = [
                "AngularJs",
                "KnockoutJs",
                "Asp",
                "BASIC",
                "C",
                "C++",
                "Clojure",
                "COBOL",
                "ColdFusion",
                "C#",
                "VB",
                "SQL",
                "Haskell",
                "Java",
                "JavaScript",
                "Lisp",
                "Perl",
                "PHP",
                "Python",
                "Ruby",
                "Scala",
                "Scheme"
            ];
    
            $("#tags").autocomplete({
                source: SearchData
            });
        });
    </script>
    thanks.

      Modified On Apr-11-2018 05:18:01 AM

Answer