$(document).ready(function(){
$('#id').focus();
var x = $('#id').val();
splitext = x.split("");
var total = 0;
var mul = 13;
for(i=0;i<splitext.length-1;i++) {
total = total + splitext[i] * mul;
mul = mul -1;
}
mod = total % 11;
nsub = 11 - mod;
mod2 = nsub % 10;
if(mod2!=splitext[12])
{
alert("รหัสบัตรประชาชนไม่ถูกต้อง");
return false;
}