I have a script which allows to display bing search results: JsFiddle
If you type a letter you will see the results for this letter. If you then do backspace and then type the same letter you will not get any results, so:
- type letter = results
- backspace = remove results
- typing same (first) letter = NO results
This happens becouse I set a code to take clear the results if the val of input is empty like this:
$('#searchbox').live('keyup', function(){
var teq = $('#searchbox').val();
doSearch(teq);
if (teq == '')
{
clearResults();
}
});
So by clearing the results like this I’m actually causing a problem the same time becouse there are no results for the second time a same query is made. So my question is: How can I clear the results in a way that I would still be able to do the same query? Which means:
- type letter = results
- backspace = remove results
- typing same (first) letter = results
You have in your code this comment:
therefore I changed the statement
to:
You can see the result: http://jsfiddle.net/F9T7E/10/