0

I have an input field in which any user can paste only numbers but if the string contains any alphabet then it will not allow to paste.

i am currently using this code but its not work;

$('[id$=CRRId]').bind('paste', function(e) { 
    var charCode = (e.which) ? e.which : e.keyCode;
if(charCode != 45 && (charCode != 46 || $(this).val().indexOf('.') != -1) && (charCode < 48 || charCode > 57))
{
return true;
}
else
{
  return false;
}
});

Please suggest correct code, Your answer will be highly appreciated.

0 Answers0