Product Bundles
DevCraft
All Telerik .NET tools and Kendo UI JavaScript components in one package. Now enhanced with:
Web
Mobile
Document Management
Desktop
Reporting
Testing & Mocking
CMS
UI/UX Tools
Debugging
Free Tools
Support and Learning
Productivity and Design Tools
Hi Team,
I would like to get selected text along with html tags but getting only plain text by using
editor.getSelection() or editor.getRange() methods. Please help me to get html selected text
Hello, Lavanya,
I am not entirely certain if I understand the exact requirement, however you can retrieve the parent element of the text node like this:
var selection = editor.getSelection(); console.log($(selection.anchorNode).parent()[0].outerHTML);
https://dojo.telerik.com/@gdenchev/EnEyewAj
If you select the text and then click on the button, you'll see the following result in the console:
Best Regards, Georgi Denchev Progress Telerik
Love the Telerik and Kendo UI products and believe more people should try them? Invite a fellow developer to become a Progress customer and each of you can get a $50 Amazon gift voucher.