admin管理员组

文章数量:1336660

I want to select current(cursor position) element in CKEditor using java script.

When right click event happens i have to select an element where i am right clicking.

I want to select current(cursor position) element in CKEditor using java script.

When right click event happens i have to select an element where i am right clicking.

Share Improve this question edited Jul 17, 2012 at 11:33 Ramesh asked Jul 17, 2012 at 10:13 RameshRamesh 1,0836 gold badges26 silver badges53 bronze badges 2
  • 1 What do you mean by "current (cursor position) element"? – Reinmar Commented Jul 17, 2012 at 11:11
  • i am using context menu item. when an context menu button clicked i have to select that element where the click happens. – Ramesh Commented Jul 17, 2012 at 11:35
Add a ment  | 

1 Answer 1

Reset to default 7

This is the solution you're looking for:

var editor = CKEDITOR.instances.editor1,
    sel = editor.getSelection();

sel.selectElement(sel.getStartElement());

本文标签: javascriptHow to select current element in CKEditorStack Overflow