Fork me on GitHub

Example: Basic multiautocomplete creation

How to create a multiautocomplete.

Basic MultiAutoComplete creation

Use the following code to create a basic inputEx MultiAutoComplete. (note: this example doesn't work offline)


<div id="field-container"></div>



YUI().use('inputex-multiautocomplete', function(Y) {
      var field = new Y.inputEx.MultiAutoComplete({
        parentEl: 'container1', 
        label: 'Search US state',

        // autocompleter options
        autoComp: {
          source: ["aaa","bbb","cccc","ccc","dddddd"],
          minQueryLength: 2,
          maxResultsDisplayed: 50

      var logDiv ='div', null, null, "");'#container1').appendChild(logDiv);

      field.on("updated",function(v) {
         var value = Y.JSON.stringify(v);
         logDiv.appendChild('div',null,null,"Updated at "+(new Date())+" "+value) );