This is a migrated thread and some comments may be shown as answers.

eventhandler for Html area

1 Answer 33 Views
Editor
This is a migrated thread and some comments may be shown as answers.
Christian Ungerboeck
Top achievements
Rank 1
Christian Ungerboeck asked on 19 Dec 2008, 05:16 PM

Hello,

I intend to fire an event if the user changes some content in the design and html mode, too by using code like this:

 OnKeyDownTextEditorHandler = function (e)
{  
//do some stuff
};

myEditor.attachEventHandler("onkeydown", OnKeyDownTextEditorHandler);

This is working fine for the design mode but in the Html mode there is no event fireing anymore. I found some old posts, telling u have to find the editor in the dom and append the event manually.This solution can not be the only one. There has to be a buildin editor feature which solves that issue because it is usual and often needed I guess. Maybe someone can give me a hint.

thank u 

CSD

1 Answer, 1 is accepted

Sort by
0
Accepted
Rumen
Telerik team
answered on 22 Dec 2008, 03:01 PM
Hello Christian,

If you want to attach an event handler to Html mode you should get a reference to the textarea in this mode with

 var textarea = editor.get_textArea();

and after that to attach the desired event handlers to it, e.g.

 textarea.attachEvent("onkeydown", function);
 textarea.attachEvent("onclick", function);

etc.

You can use the get_mode method which returns the current mode.


Kind regards,
Rumen
the Telerik team

Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Tags
Editor
Asked by
Christian Ungerboeck
Top achievements
Rank 1
Answers by
Rumen
Telerik team
Share this question
or