On Mar 3, 8:54 am, "hygum" <thomashy...@gmail.com> wrote:
> I have a combobox on this testsite: sneleopard.dk/combobox.html
> it should show all records containing the search string while typing.
> But sometimes it only shows some of them, why?
> 1) type "spi" and it shows among others "spinat helbladet"
> 2) delete the search string and type "bla"
> 3) it should now among others show "spinat helbladet" again, but it
> doesnt, why?
I changed your function, so that the array search is done once in one
loop only and it gives me none of the problems above.
Code:
for(i = 0; i < functionListLength; i++)
{
if( ( functionlist[i].search(re1) >= 0 ) ||
( functionlist[i].search(re2) >= 0 ) )
{
selectObj[numShown] = new Option(functionlist[i],comboids[i]);
numShown++;
}
}
You will have to clean up the variables not used, like
"visteelementer".
In my opinion you can leave out the first criteria (first search) as
the second criteria will find also those who starts with the search
string!
Best wishes,
John, Latvia