Is there a way to fire up Scriptaculous's Autocomplete to search with the default word from the inputfield when the page is loaded?
Something like this?
<input type="text" id="autocomplete" class="autocomplete_input" name="autocomplete_parameter" value="friends"/>
<span id="indicator1" style="display: none">
loading
</span>
<div id="autocomplete_choices" class="autocomplete">
</div>
<script type="text/javascript">
function AutoComp() {
var myAutoCompleter = new Ajax.Autocompleter("autocomplete", "autocomplete_choices", "url", {indicator: 'indicator1',});
}
document.onLoad = AutoComp.activate();
</script>
My fault!
var myAutoCompleter = new Ajax.Autocompleter("autocomplete", "autocomplete_choices", "api/usersearch/", {indicator: 'indicator1'});
document.observe("dom:loaded", function() {
myAutoCompleter.activate();
});
</script>
This did the trick
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.