(function(a){a.fn.digits=function(b){b=a.extend({selectable:!0,insert:!0,dragndrop:!0,inputErrorClass:"",errorClass:"",errorText:""},b);a.fn.digits.selectable=b.selectable;a.fn.digits.insert=b.insert;a.fn.digits.dragndrop=b.dragndrop;a.fn.digits.inputErrorClass=b.inputErrorClass;a.fn.digits.errorClass=b.errorClass;a.fn.digits.errorText=b.errorText;this.keypress(function(a){if(!(a.ctrlKey||a.altKey||a.metaKey)){var c=function(a){return null==a.which?32>a.keyCode?null:String.fromCharCode(a.keyCode):
0!=a.which&&0!=a.charCode?32>a.which?null:String.fromCharCode(a.which):null};if(null!=c(a)&&("0">c(a)||"9"<c(a)))return!1}});a.fn.digits.selectable||this.css({"-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"});a.fn.digits.dragndrop||(this.on("dragover",function(a){a.preventDefault();a.stopPropagation();return!1}),this.on("dragleave",function(a){a.preventDefault();a.stopPropagation();return!1}),
this.on("drop",function(a){a.preventDefault();a.stopPropagation();return!1}));this.bind("paste",function(b){if(!a.fn.digits.insert)return b.preventDefault(),!1;if(!/([0-9])/g.test(this.value))return b.preventDefault(),a(this).addClass(a.fn.digits.inputErrorClass),0==a(this).parent().has("span."+a.fn.digits.errorClass).length&&(console.log(a(this).parent().has("span."+a.fn.digits.errorClass)),a(this).parent().append('<span class="'+a.fn.digits.errorClass+'">'+a.fn.digits.errorText+"</span>")),!1});
this.on("focusout blur",function(b){a(this).removeClass(a.fn.digits.inputErrorClass);a(this).parent().find("span."+a.fn.digits.errorClass).remove()});return this}})(jQuery);
(function(a){a.fn.digits=function(b){b=a.extend({selectable:!0,insert:!0,dragndrop:!0,inputErrorClass:"",errorElement:"span",errorClass:"",errorText:""},b);a.fn.digits.selectable=b.selectable;a.fn.digits.insert=b.insert;a.fn.digits.dragndrop=b.dragndrop;a.fn.digits.inputErrorClass=b.inputErrorClass;a.fn.digits.errorElement=b.errorElement;a.fn.digits.errorClass=b.errorClass;a.fn.digits.errorText=b.errorText;this.keypress(function(a){if(!(a.ctrlKey||a.altKey||a.metaKey)){var c=function(a){return null==
a.which?32>a.keyCode?null:String.fromCharCode(a.keyCode):0!=a.which&&0!=a.charCode?32>a.which?null:String.fromCharCode(a.which):null};if(null!=c(a)&&("0">c(a)||"9"<c(a)))return!1}});a.fn.digits.selectable||this.css({"-webkit-touch-callout":"none","-webkit-user-select":"none","-khtml-user-select":"none","-moz-user-select":"none","-ms-user-select":"none","user-select":"none"});a.fn.digits.dragndrop||(this.on("dragover",function(a){a.preventDefault();a.stopPropagation();return!1}),this.on("dragleave",
function(a){a.preventDefault();a.stopPropagation();return!1}),this.on("drop",function(a){a.preventDefault();a.stopPropagation();return!1}));this.bind("paste",function(b){if(!a.fn.digits.insert)return b.preventDefault(),!1;if(!/([0-9])/g.test(this.value))return b.preventDefault(),a(this).addClass(a.fn.digits.inputErrorClass),0==a(this).parent().has(a.fn.digits.errorElement).length&&(b=a(document.createElement(a.fn.digits.errorElement)).addClass(a.fn.digits.errorClass).text(a.fn.digits.errorText),a(this).parent().append(b)),
!1});this.on("focusout blur",function(b){a(this).removeClass(a.fn.digits.inputErrorClass);a(this).parent().find(a.fn.digits.errorElement).remove()});return this}})(jQuery);

add new option - errorElement