JSFiddle - React, Tailwind, and code Playground
by dhruv1992
HTML
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<input type="text" id="dateofbirth">.
JavaScript
$("#dateofbirth").on('keyup',function(event){
console.log('hey')
var key = event.keyCode || event.charCode;
if (key == 8 || key == 46) return false;
var strokes = $(this).val().length;
console.log(strokes)
if(strokes === 2 || strokes === 5){
var thisVal = $(this).val();
thisVal += '/';
$(this).val(thisVal);
}
});