while typing in an input, I want to validate the text character by character e.g text is: The Quick Brown Fox
I want to match character by character
like: initially, text box in empty:
I press
T => OK
h => OK
a => Not Ok (will not be written in the text)
e => OK
and so on
I've written this jquery regex expression. But, it's not working as it is comparing the whole text.
$("#text").on("keypress", function(e) {
if (!(/^The Quick Brown Fox$/i.test($(this).val()+String.fromCharCode(e.keyCode)))) {
return false;
}
}
$(this).val()+) when you test.lookupString.indexOf($(this).val()) !== -1instead?