Saturday, October 5, 2024
Google search engine
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

Most Popular

Recent Comments