I want to do adhar card validation i.e. values in textbox must be 12 digits or 16 digits.
I am trying below javascript code :
adhar = document.getElementById("txtaadhar").value;
var adharcard = /^\d{12}$/;
var adharsixteendigit = /^\d{16}$/;
if (adhar != '') {
if (!adhar.match(adharcard))
{
alert("Invalid Aadhar Number");
return false;
}
}
if (adhar != '')
{
if(!adhar.match(adharsixteendigit))
{
alert("Invalid Aadhar Number");
return false;
}
}
what changs i should do to get my output
Thanks