Hi There, I am attempting to capture user input using jquery and the keydown event.
Here's my code:
$(document).ready(function() {
$("#searchText").keydown(function() {
var filter = jQuery.trim($(this).val());
if (filter.length > 3 || filter.length == 0) {
//hit the index action again and pass the keyword
$("#results").fadeOut("fast");
$("#results").load("/Organisation/Index?keyword=" + filter, null, function() {
$(this).fadeIn("fast");
});
}
});
});
At the mo this is working, aside from the fact that the string captured always seems to be 'out of date' by one character and I have to press another key to actually get the text I want passed to my action.
Thanks in advance!