Cancel key press

4 posts, 0 answers
  1. David
    David avatar
    16 posts
    Member since:
    Jan 2008

    Posted 01 Feb 2008 Link to this post


    In the editor is there a way to cancel key presses? I've tried a couple of things (onkeyup return false etc). But the key pressed still gets into the text?

  2. George
    George avatar
    298 posts

    Posted 04 Feb 2008 Link to this post

    Hi David,

    You may try with onkeydown event because it is fired before the character is placed in the editor. I have implemented one sample project on the required functionality, please have a try and in case of some questions do not hesitate to ask.

    Sincerely yours,
    the Telerik team

    Instantly find answers to your questions at the new Telerik Support Center
  3. Manju
    Manju avatar
    1 posts
    Member since:
    Feb 2017

    Posted 08 Aug 2017 in reply to George Link to this post

    I know this is a very old thread. But, how do we do it with latest version. Same code found in the attachment does not work with V2017 editor control. 
  4. Rumen
    Rumen avatar
    14317 posts

    Posted 09 Aug 2017 Link to this post


    You can prevent the key execution with $telerik.cancelRawEvent(e);
    You can get the selected element with editor.getSelectedElement() 

    Here is an example how to disable the typing inside an A tag:

    <telerik:RadEditor ID="r1" runat="server" OnClientLoad="OnClientLoad">
    dasdsad <a href="" >test</a> dasdassd
    <script type="text/javascript">
        function OnClientLoad(editor, args) {
            editor.attachEventHandler("onkeydown", function (e) {
                if (editor.getSelectedElement().tagName.toLowerCase() == "a") {

    Progress Telerik
    Try our brand new, jQuery-free Angular 2 components built from ground-up which deliver the business app essential building blocks - a grid component, data visualization (charts) and form elements.
Back to Top