title: Javascript Auto Suggest
body: <p>Is there a library available for Auto Suggest/Complete for cases like the following</p>
  
  <p>Searching for "Vir" returns both "West Virginia" and "Virginia"</p>
  
  <p>Thanks</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>Sorry for not explaining it more. In the problem above, I do not want a "contains" search, but a prefix search on word boundaries. So "est" should not return "West Virginia", but "wes" or "vir" should.</p>
  
  <p>The list is around 500 items large.</p>
  
  <p><strong>Proposed Solution</strong></p>
  
  <p>I modified the trie implementation by Mike de Boer <a href="https://github.com/mikedeboer/trie" rel="nofollow">https://github.com/mikedeboer/trie</a> to solve this. I split an item on word boundaries and stored each word in the trie. For the last letter of each word I stored the index of the item that the word came from in the trie node. When user searches, I return a list of indices and then get the corresponding items from the main list.</p>
  
  <p>What do you guys think?</p>