JQuery and Grails / HTML - Make a text box full text, e.g. Google

I want certain fields on my page to show me a list of possible final offers, like Google does.

I think this is done through jQuery, but I'm not sure.

The text box is called the item.

Let's say I write General, and in the list, array or database I have a Common item, I have to show me the Common item under the text box.

Thanks in advance!

------- UPDATE -------

 <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js">
var data = "General Commodity,General Store,General Custer,General Mills".split(",");

    $("#Ccommodity").autocomplete({
            source: data
        });
</script>

When I go to the Ccommodity input text box, I write G and nothing happens, maybe I have a syntax error.

thanks for the help

+3
source share
2 answers

, jQueryUI Autocomplete. , -, .

: http://jsfiddle.net/QU9st/

:

$(function() {
    var data = "General Commodity,General Store,General Custer,General Mills".split(",");
    $("#commodity").autocomplete({
            source: data
        });
});

, , JSON XML.

, - <head>:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js"></script>

, jQuery:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
+4

jQuery Autocomplete , . : JQuery:

var data = "Core Selectors Attributes Traversing Manipulation CSS Events Effects Ajax".split(" ");
$("#commodity").autocomplete(data);

HTML:

<input type="text" id="commodity" name="commodity">
+3

Source: https://habr.com/ru/post/1768289/


All Articles