I have 2 fields when I type in ID NO field (first six number is date of birth with YYMMDDxxxxxx
, (always contains 12 number), the DOB field will auto filled, based on ID NO, but the value of DOB only contains first 6 number in ID NO field and the order will be DDMMYY
.
Example:
ID NO: 931121091010 (YYMMDD)
DOB : 211193 (DDMMYY)
var $dob = $("#dob");
$("#id_no").keyup(function() {
$dob.val(this.value);
});
$("#id_no").blur(function() {
$dob.val(this.value);
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.1/jquery.min.js"></script>
<form>
<div>
<label>ID NO</label>
<input type="text" name="id_no" id="id_no" class="form-control" onKeyPress="return
goodchars(event,'1234567890',this)" required="" value="">
</div>
<div>
<label>DOB</label>
<input type="text" name="dob" id="dob" class="form-control" value="">
</div>
</form>
</div>