Date Mask Text Field using only HTML,JavaScript

1

Placeholder
The placeholder attribute specifies a short hint that describes the expected value of an input field (e.g. a sample value or a short description of the expected format).

I have used Regular Expression.I am checking if 2 digits are entered if yes i have appened a slash.

<input 
	type="text" 
	name="date" 
	placeholder="dd/mm/yyyy" 
	onkeyup="
		var v = this.value;
		if (v.match(/^\d{2}$/) !== null) {
			this.value = v + '/';
		} else if (v.match(/^\d{2}\/\d{2}$/) !== null) {
			this.value = v + '/';
		}"
	maxlength="10"
>