HomeLanguagesJavascriptscript.aculo.us Autocompleter Frequency Option

script.aculo.us Autocompleter Frequency Option

The local array autocompleter is used when you’d prefer to inject an array of autocompletion options into the page, the array is used to apply the autocomplete functionality on your page.

Autocompleter Frequency Option: The frequency option determines how frequently (in seconds) the input field auto completion suggestions should be refreshed for changes before firing an Ajax request.

Syntax:

{ frequency: seconds }

Values:

  • seconds: This is a float value. The default value is 0.4.

Example 1: In this example, we have set the frequency option to 3s, so it will take 3s to update the recommendations.

HTML




<!DOCTYPE html>
<html>
 
<head>
    <script type="text/javascript"
        src="javascript\prototype.js">
    </script>
 
    <script type="text/javascript" src=
"javascript/scriptaculous.js?load = effects,controls">
    </script>
</head>
 
<body>
    <h1>neveropen</h1>
    <label for="neveropen">
        Input any name:
    </label>
 
    <br>
    <input id="neveropen" autocomplete="off"
        size="40" type="text" value="" />
     
    <div class="autocomplete" id="names"
        style="display:none">
    </div>
     
    <script type="text/javascript">
 
        var names = [
            'Ab gfg',
            'Abc gfg',
            'Abcd gfg',
            'Abcde gfg',
            'Abcdef gfg',
            'Abcdefg gfg',
            'Abcdefgh gfg'
        ];
 
        new Autocompleter.Local(
            'neveropen',
            'names',
            names,
            { frequency: 3 }
        );
    </script>
</body>
 
</html>


Output:

Example 2: In this example, we have set the frequency option to .1s, so it will take .1s to update the recommendations.

HTML




<!DOCTYPE html>
<html>
 
<head>
    <script type="text/javascript"
        src="javascript\prototype.js">
    </script>
     
    <script type="text/javascript" src="
javascript/scriptaculous.js?load = effects,controls">
    </script>
</head>
 
<body>
    <h1>neveropen</h1>
 
    <label for="neveropen">
        Input any name:
    </label>
    <br>
     
    <input id="neveropen" autocomplete="off"
        size="40" type="text" value="" />
 
    <div class="autocomplete" id="names"
        style="display:none">
    </div>
     
    <script type="text/javascript">
 
        var names = [
            'Ab gfg',
            'Abc gfg',
            'Abcd gfg',
            'Abcde gfg',
            'Abcdef gfg',
            'Abcdefg gfg',
            'Abcdefgh gfg'
        ];
 
        new Autocompleter.Local(
            'neveropen',
            'names',
            names,
            { frequency: .1 }
        );
    </script>
</body>
 
</html>


Output:

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

4 COMMENTS

Most Popular

Dominic
32686 POSTS0 COMMENTS
Milvus
131 POSTS0 COMMENTS
Nango Kala
7053 POSTS0 COMMENTS
Nicole Veronica
12194 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12291 POSTS0 COMMENTS
Shaida Kate Naidoo
7179 POSTS0 COMMENTS
Ted Musemwa
7444 POSTS0 COMMENTS
Thapelo Manthata
7157 POSTS0 COMMENTS
Umr Jansen
7147 POSTS0 COMMENTS