Hi, Ok solved my problem. Using methods shown here: http://www.mattryall.net/blog/2008/07/jquery-filter-demo
Cheers, Bryan Rasmussen On Jan 28, 12:06 pm, pantagruel <rasmussen.br...@gmail.com> wrote: > Hi, > > I have something like the following (fragment but shows context): > > var currentActiveCommands = jQuery("#menudiv ul li.runnable").find > ("a.c"); > var len = currentActiveCommands.length; > var resulthtml = ""; > var field = document.getElementById("run_command"); > var currentidtoclick =""; > > var display = jQuery("#autocompletval"); > var incrementer = 0; > if(which != 13){ > if(len > 2){ > > var reg = new RegExp(field.value,"i"); > currentActiveCommands.each(function(i) { > if(reg.test($(this).html())) > { > > if(incrementer == 0){ > > firstidinline = $(this).attr("id"); > > //alert("i is less than 1" + > currentidtoclick); > } > incrementer = incrementer + 1; > currentidtoclick = $(this).attr("id"); > //alert(currentidtoclick); > > //note clicker function must be made cross- > browser, IE uses fireEvent I use dispatchevent > resulthtml = resulthtml + "<a href='#' > onclick='clicker(\"" + currentidtoclick + "\")'>" + $(this).html() + > "</a><br />" > display.html(resulthtml); > display.css("display", "block"); > > // Add to body element > > }else{ > > } > > }); > > Anyway as can be seen what happens here is the data that needs to be > queried is inside the document, currently hidden but could be > displayed in some cases. > When someone starts entering data in the input field it goes through > this data and makes an autocomplete from the data in the document. The > problem is that if data entered in the input field initially can match > something in the document but then stops matching the previously > possible matches are not removed from the display. What is the best > way to handle this? > > Also should I perhaps do an initial read in of this data to some > arrays and then do matches on the arrays? Or another suggestion?