I think I just have a fundamental misunderstanding of how this works. I'm am trying to create a snippet that validates an input field's entry in real time. The input is inside a Bootstrap popover, and thus no usual forms of date validation are working for me. This will only be used on one device, a Kindle 7, on chrome. what I have so far is
$('#datePicker').on('shown.bs.popover', function(){
$('[name="start"], [name="end"]').on('input', function(e){
if(e.key.search(/[0-9]|tab|enter|shift|control|alt/i) >= 0){
console.log("Good input:" + e.key);
}else{
console.log("Bad input:" + e.key);
e.preventDefault();
e.stopPropagation();
}
});
$('[name="start"], [name="end"]').on('keyup',function(){
if(this.value.length == 2 || this.value.length == 5){
this.value = this.value + "-";
}
});
});
My thinking being that the event "input" holds some data about what happened. Through all of my searching though, I have found no such data. I was using "keydown" instead, and it did work perfectly, except that the Kindle's virtual keyboard only returned undefined values, and that's when I was saw someone suggest using "input" instead.
Could someone please let me know what I'm doing wrong