Skip to content Skip to sidebar Skip to footer

Jquery Many Autocompletes On The Same Page

I'm trying to implements the autocomplete function of Jquery on a formulary made on a jsp. I have no problems for one textarea, but impossible to do that with many of them. This is

Solution 1:

You can find a demo of 2 autocomplete input-fields (not textarea) here. Could you give es more datails how it is not working. Do you get any errors in the java-script console

$(function() {
    var availFirstNames = [
        "Adam", "Anna", "Anita",
        "Bert", "Bob", "Chuck", "Claudia", "Douche", "Ernie",
        "Gib", "Henry", "Jesus", "John", "Lisp", "Perl",
        "PHP", "Python", "Ruby", "Scala", "Scheme"
    ];
    var availLastNames = availFirstNames;
    $( "#FirstName" ).autocomplete({
        source: availFirstNames
    });
    $( "#LastName" ).autocomplete({
        source: availLastNames
    });        
});

And the HTML

<divclass="ui-widget"><labelfor="tags">Names: </label><inputid="FirstName" /><inputid="LastName" /></div>

Post a Comment for "Jquery Many Autocompletes On The Same Page"