In this
article I will explain How
to disable backspace except textbox using JavaScript in ASP.NET.
(Or)
How to disable backspace in textbox using JavaScript in ASP.NET
(Or)
How to disable backspace in textbox using JavaScript in ASP.NET
I designed the ASPX page. In that page I declared
one textbox, Textbox not allowed backspace.
Below is sample code for textbox design. Here
we can use onKeyDown event for disable back button code.
<asp:TextBox runat="server" ID="txtPODate" Width="200px"
onKeyDown="preventBackspace();"></asp:TextBox>
Below
is the sample JavaScript code for disable Back Button.
function
preventBackspace(e) {
var evt = e || window.event;
if (evt) {
var keyCode = evt.charCode || evt.keyCode;
if (keyCode === 8) {
if (evt.preventDefault) {
evt.preventDefault();
} else {
evt.returnValue = false;
}
}
}
}
No comments:
Post a Comment