Question



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?

Était-ce utile?

La solution 2

To delete your DOM references, you do

bigAutoCompleteObject = null;

Autres conseils

  • 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;
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top