Jquery - Using Selector :contains - Weird Results
Story so far..... I want to learn JQuery, and im also building an MVC ASP.NET Apps which requires a 'search as you type' search function - perfect to learn JQuery as well! So far (
Solution 1:
because this.value
on the keydown event does not contain the keystoke which triggered the event. Use keyup instead.
You can access the keystoke via the event object which is available in the function... but the value of the input will not contain it until the key is released.
http://jsfiddle.net/rlemon/TGBUe/1/ in this example you can open your console... and type a character in the input... you will notice the keydown this.value is blank for the first char whereas the keyup contains it.
Solution 2:
Maybe the check fires before the AJAX part has completed.
Mind that AJAX is asynchronous and the code continues its flow regardless of the AJAX request, that is completed asynchronously.
Try to move the logic insidefunction(JSONData)
.
Post a Comment for "Jquery - Using Selector :contains - Weird Results"