HI All,
In my my project, which is based on SharePoint.
I have web part where i have controls in it.
One Control should accept only Numbers.( The Controls are placed in Update Panel).
Please find the below suitable code. which is working in all Browsers.
$('#<%=txtTerminalID.ClientID %>').live("keypress", function (e) {
var key = (e.keyCode ? e.keyCode : e.which);
if ((key == 8) || (key == 46) || (key >= 48 && key <= 57) || (key == 9)) {
} else { e.preventDefault(); }
});
for more clarification refer http://www.asciitable.com/
In my my project, which is based on SharePoint.
I have web part where i have controls in it.
One Control should accept only Numbers.( The Controls are placed in Update Panel).
Please find the below suitable code. which is working in all Browsers.
$('#<%=txtTerminalID.ClientID %>').live("keypress", function (e) {
var key = (e.keyCode ? e.keyCode : e.which);
if ((key == 8) || (key == 46) || (key >= 48 && key <= 57) || (key == 9)) {
} else { e.preventDefault(); }
});
for more clarification refer http://www.asciitable.com/
0 comments:
Post a Comment