Recently, I've been playing around with the AJAX Live Search feature that can be found on this site: http://www.w3schools.com/php/php_ajax_livesearch.asp
The way it transfers the input value via AJAX to a php file for comparison is quite interesting.
However, I have noticed one issue that is bothering me:
When I quickly type in some characters and then delete all of my input, sometimes there are still results displayed from the last character I deleted.
For example, typing asdfgh
yields no suggestion
.
But if I delete all the characters, the result for a
is still shown:
HTML a tag
HTML br tag
CSS background Property
JavaScript Date Object
JavaScript Array Object
I have tried various ways to fix this behavior by tweaking the onkeyup
part of the code within the javascript itself, experimenting with different events, but nothing seems to work.
I even tested this on my mobile phone and another PC, but the issue persists.
Any suggestions on how to eliminate this behavior?