Disable Backspace from master page

3 posts, 0 answers
  1. Ray Merckel
    Ray Merckel avatar
    5 posts
    Member since:
    Mar 2009

    Posted 05 Apr 2010 Link to this post


    RadControls version 2009.3.1314.35


    .NET version 3.5


    Visual Studio version


    programming language


    browser support

    all browsers supported by RadControls

    JavaScript to disable backspace from master page except in textbox, datetime, or textarea...

    <script type="text/javascript">
        function killBackSpace(e) {
            e = e ? e : window.event;
            var t = e.target ? e.target : e.srcElement ? e.srcElement : null;
            if (t && t.tagName && (t.type && /(password)|(text)|(file)/.test(t.type.toLowerCase())) || t.tagName.toLowerCase() == 'textarea')
                return true;
            var k = e.keyCode ? e.keyCode : e.which ? e.which : null;
            if (k == 8) {
                if (e.preventDefault)
                return false;
            return true;
        if (typeof document.addEventListener != 'undefined')
            document.addEventListener('keydown', killBackSpace, false);
        else if (typeof document.attachEvent != 'undefined')
            document.attachEvent('onkeydown', killBackSpace);
        else {
            if (document.onkeydown != null) {
                var oldOnkeydown = document.onkeydown;
                document.onkeydown = function(e) {
                document.onkeydown = killBackSpace;

  2. Rumen
    Rumen avatar
    14361 posts

    Posted 07 Apr 2010 Link to this post

    Hi Ray,

    Thank you for sharing this code snippet with the community.

    Despite that is not directly related to RadControls for ASP.NET AJAX controls, I decided to post it since it could be helpful in scenarios when using the Telerik controls.

    I also updated your Telerik points for your contribution.

    the Telerik team

    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
  3. NEX
    NEX avatar
    84 posts
    Member since:
    Aug 2007

    Posted 03 Feb 2014 in reply to Ray Merckel Link to this post

    Was looking for this for awhile. Works great! Thanks!
Back to Top

This Code Library is part of the product documentation and subject to the respective product license agreement.