Align the selected text in radeditor through cusotmise function.

Thread is closed for posting
2 posts, 0 answers
  1. bibhudatta Mangaraj
    bibhudatta Mangaraj avatar
    8 posts
    Member since:
    Jan 2010

    Posted 21 Jan 2010 Link to this post

    Hi i am using the below code for checking the selected paragraph and do the alignment,But i couldn't able to achive the solution.
    Some how i need to clear the innerHtml and applay alignment and replace it back.Pls help me out.







    var editor =$find("RadEditor1");



    var docObject =$(editor._contentArea);



    var elem = editor.getSelectedElement()



    if (elem.tagName == "P")





    var paraId=$(docObject).find("p");










    "p#IndentParaId")[0].id = "";


  = "IndentParaId";


    currentParaId =;





    // argument = elem;








    var content = editor.getSelectionHtml();



    // var link = editor.get_document().createElement("p");



    var link = editor.get_document();





    link.innerHTML= content;


    // link.setHtml=



    if (link.tagName != "")



    link.innerHTML = content;




    "Delete", null, false);






    // argument = link;



    // $(link).find("P");


    $(link)[0].style.textAlign =obj;



  2. Dobromir
    Dobromir avatar
    1633 posts

    Posted 26 Jan 2010 Link to this post

    Hi Bibhudatta,

    After examining the provided code I noticed the following problems:
    • editor.Document.execCommand("Delete", null, false);
      This is a RadEditor Classic method - should be editor.get_document().execCommand("Delete", null, false)
    • var link = editor.get_document();
      link.innerHTML = content;
      editor.get_document() returns the document object of the <iframe> used for the content area and it has no innerHTML property - should be link.body.innerHTML = content;

    I am not really sure that I can fully understand your question. Could you please provide detailed information about your specific scenario and what errors do you get after execution of this function?

    Best wishes,

    the Telerik team


    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top