You can extend the 'creditcard' validating type and apply it to a inputing box.
<script type="text/javascript">
$.extend($.fn.validatebox.defaults.rules, {
creditcard: {
validator: function(value,param){
if ( /[^0-9 \-]+/.test( value ) ) {
return false;
}
value = value.replace( /\D/g, "" );
if ( value.length < 13 || value.length > 19 ) {
return false;
}
var nCheck = 0,
nDigit = 0,
bEven = false,
n, cDigit;
for ( n = value.length - 1; n >= 0; n-- ) {
cDigit = value.charAt( n );
nDigit = parseInt( cDigit, 10 );
if ( bEven ) {
if ( ( nDigit *= 2 ) > 9 ) {
nDigit -= 9;
}
}
nCheck += nDigit;
bEven = !bEven;
}
return ( nCheck % 10 ) === 0;
},
message: 'Please enter a valid credit card number.'
}
})
</script>
<input class="easyui-textbox" validType="creditcard">