how to remove element

3 posts, 0 answers
  1. hepek
    hepek avatar
    8 posts
    Member since:
    Feb 2020

    Posted 18 Feb Link to this post

    I am trying to enable "delete control" functionality via right-click menu.
    so far I have a code like this, but I cannot find the appropriate function like editor.DeleteSelectedElement (or something like that):

     Telerik.Web.UI.Editor.CommandList["Remove Hyperlink"] = function (commandName, editor) {
                var hyperLink = editor.getSelectedElement(); // get the selected Hyperlink element.   
                editor.selectElement(hyperLink); // select the hyperlink
                *I need to delete selected element here. how do I do that? 
     };

     

    thank you

  2. Rumen
    Admin
    Rumen avatar
    14275 posts

    Posted 19 Feb Link to this post

    Hi Nermin,

    You can use 

    editor.getSelectedElement().remove();

    or

    editor.get_document().execCommand("Delete");

    If you'd like to unlink the link you can execute:

    editor.fire("Unlink");

    I hope this helps.

    Regards,
    Rumen
    Progress Telerik

    Get quickly onboarded and successful with UI for ASP.NET AJAX with the Virtual Classroom technical trainings, available to all active customers. Learn More.
  3. hepek
    hepek avatar
    8 posts
    Member since:
    Feb 2020

    Posted 19 Feb in reply to Rumen Link to this post

    thank you for very nice support!
Back to Top