Function that replaces character and allow only numbers into the textbox
This technique we can use on the onkeyup property of HTML element
<input type="text" id="txtMobileNo"
onkeyup="if (/D/g.test(this.value)) this.value = this.value.replace(/D/g,'')"