Javascript/jQuery:
$(document).ready(function () {
$('#txt').bind("paste", function (e) {
var $this = $(this);
$this.val($this.val().replace(/[^\d.]/g, ''));
});
});
Html:
<asp:TextBox ID="txt" runat="server"></asp:TextBox>
If value as below
10-10-20.0a
Result must be as below
1010200
I only want to allow it to paste numeric values to the textbox, otherwise, disable it. However, if I try the above javascript code, it is not working.
Where did I miss on the javascript side?