I have an input field where users are supposed to enter their date of birth. The pattern which I want to use is for example 24-06-2019
. So, now I want to make some kind of validation, and if the user entered the wrong pattern there should be some kind of alert. How can I achieve that?
Here is what I got so far:
$('input[name="dateOfBirth"]').on("keyup", () => {
let current_value = $('input[name="dateOfBirth"]').val();
// some validation here?
});