HOW TO USE AUTOCOMPLETE IN JQUERY

Pawan Shukla

Total Post:38

Points:274
Posted by  Pawan Shukla
JQuery 
 675  View(s)
Ratings:
Rate this:
I want to use jquery autocomplete search box in my project . Please help me by giving a demo .
  1. aditya kumar Patel

    Post:254

    Points:1810
    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 Sep-28-2016 06:21:39 AM

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!