jeudi 18 juin 2015

adding checkbox to auto complete

I am working on this code and i have used jquery ui for autocomplete but i need some help in adding checkboxes to it so that i can do multiple selections and it reflect on my field with comma seperation. I found a plugin exactly what i want to create but I don't want to use any plugin for my work.

<script src="js/jquery-1.11.1.min.js"></script>
<script src="js/jquery-ui.js"></script>
<link rel="stylesheet" href="js/jquery-ui.css">
<body>
    <input id="condition" type="text" placeholder="condition">
</body>
<script>
    var availableTags = [
               "ActionScript",
               "AppleScript",
               "Asp",
               "BASIC",
               "C",
               "C++",
               "Clojure",
               "COBOL",
               "ColdFusion",
               "Erlang",
               "Fortran",
               "Groovy",
               "Haskell",
               "Java",
               "JavaScript",
               "Lisp",
               "Perl",
               "PHP",
               "Python",
               "Ruby",
               "Scala",
               "Scheme"
    ];
    $(document).ready(function () {
        $('#condition').autocomplete({
            source: availableTags,
            minLength: 0
        }).focus(function () {
            try {
                $(this).autocomplete("search");
            }
            catch (e) {

            }
        });
    });
</script>




Aucun commentaire:

Enregistrer un commentaire