How to Validate Text fields allow only Numbers Dynamics 365 Portals.

Summary: How to Validate Text fields allow only Numbers Dynamics 365 Portals.

$(document).ready(function(){
$("#name").
keyup(function(event) {
if (
event.keyCode == 46 || event.keyCode == 8 ) {
// let it happen, don't do anything
} else if (/\D/
g.test(this.value)) {
// Filter non-digits from input value.
this.value = this.value.replace(/\D/g, '');
alert("Enter only Numbers");
}
});

});

0 comments:

Post a Comment

Popular Posts