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

Set focus to RTE?

1 Answer 82 Views
WebParts for SharePoint
This is a migrated thread and some comments may be shown as answers.
Alex Lee
Top achievements
Rank 1
Alex Lee asked on 16 Sep 2010, 11:21 PM
Hi folks,

I have a page in SharePoint 2007 that contains a number of fields, including a Rich Text Editor field that is using the Telerik version in place of the original Microsoft one.

I'm doing a little bit page manipulation using jQuery - making another field on the (SharePoint created/rendered) page disabled. The result of doing this is that the Telerik RTE loses the focus - i.e. no blinking cursor, and the user is required to click within the RTE frame in order to start typing.

What I would really like to do is set the focus back to the RTE so no click is necessary. I've tried using some jQuery calls to get the <iframe> with class "RadEContentBordered", which has a tag <body contentEditable="true"> and setting the focus on one of these elements, or the <div> within the <body>, but so far, no luck.
e.g.
$(".RadEContentBordered").focus();
$("body[contentEditable=true]").focus();
$("body[contentEditable=true] div").focus();

Can anyone at Telerik help?? Perhaps there's a Telerik JavaScript object that I can use - call a method to set the focus?

Thanks...
Alex

1 Answer, 1 is accepted

Sort by
0
Alex Lee
Top achievements
Rank 1
answered on 17 Sep 2010, 12:11 AM
OK, I've managed to answer my own question. It's the normal way, I find: ask Support a question and whilst waiting for their answer, a little more digging seems to uncover what you needed. Thanks in this case go to the IE8 Developer Tools allowing me to look at all the JS loaded, and searching through them for "focus"......... and then working out which object the function had been created in!

For me, all I needed was this line of JavaScript:
RadEditorGlobalArray[0].SetFocus();

Maybe it will help someone else...
Alex
Tags
WebParts for SharePoint
Asked by
Alex Lee
Top achievements
Rank 1
Answers by
Alex Lee
Top achievements
Rank 1
Share this question
or