title: Scriptaculous Ajax.Autocompleter extra functionality in LI
body: <p>I'm using the Ajax.Autocompleter class from the Prototype/Scriptaculous library which calls an ASP.NET WebHandler which creates an unordered list with list items that contain suggestions.</p>
  
  <p>Now I'm working on a page where you can add suggestions to a 'stop words' table, which means that if they occur in the table, they won't be suggested anymore.</p>
  
  <p>I put a button inside the LI elements and when you click on it it should do an ajax request to a page which then adds the word to the table. That works. But then I want the suggestions to be refreshed instantly, so that the suggestions appear without the word just added to the table. Preferably the selected word is the word next or before the previously clicked word.</p>
  
  <p>How do I do this? What happens instead now is that the LI you clicked the button of gets to be the selected word and the suggestions disappear.</p>
  
  <p>The list items look like this:</p>
  
  <pre><code>&lt;li&gt;{0}
   &lt;img onclick=\"deleteWord('{0}');\" src=\"delete.gif\"/&gt;
  &lt;/li&gt;
  </code></pre>
  
  <p>Where <code>{0}</code> represents the suggested word. The JavaScript function <code>deleteWord(w)</code> gets to call the webhandler which can add the word to the 'stop words' table.</p>