简体   繁体   中英

Is there a way to delete a scriptaculous autocomplete object?



I used the scriptaculous autocomplete to create a big page of editable fields, the amount of fields is dynamic, and therefore i create an array to hold all of the autocomplete objects.

then, i need to allow the user to add a field in every place of the page, so, i create a javascript function that redo the sequences of the text fields, and recreate all autocomplete's.

but there is a problem, that the old autocomplete's also appear on the page, and even if a make the array to length of zero, the old autocomplete's are hare.

Is there a way to delete completely a prototype object?

  • autocompleter holds references to input field and updater (popup element with possible choices)
  • input field and updater hold references to event observers (methods in autocompleter object)

You need at least clear references stored in autocompleter object:

autocompleter.element = null;
autocompleter.update = null;

要删除DOM引用,您可以

bigAutoCompleteObject = null;

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM