I want to allow input, for example 1:10, but not 1; 10. However: and; both correspond to keyCode 186, so using keyCode to prevent; The key to enter my input field does not work. I also studied the use of charCodes, but charCodes does not; or: values. Finally, I looked at the tables with shares. They have a comma and a colon. Is there a way for me to possibly use ascii tables to prevent; The key to enter in the text box, but is there a key :? Or is there another approach that will allow me to do this? I also thought about finding two key inputs in a line so that I can detect the switch key input, but this seems like a dirty solution.
$("input.form-1").bind({ keydown: function(e) { if(e.which ===186) { //trying to disallow semicolons, which also disallows colons return false; } } });
source share