javascriptphpjquerycleditor

Change the text direction of cleditor from right to left?


I have a form in Arabic language in which I am using CLEditor for text area.Editor works fine but earlier I have used a JavaScript function to change the text direction of textarea from right to left as the form was in Arabic. The JavaScript function used is

function rtl(element)
        {   
            if(element.setSelectionRange){
                element.setSelectionRange(0,0);
            }
        }
 <textarea name="test" id="test"   onkeyup="rtl(this);"></textarea>

How to make the JavaScript function work on cleditor? Is it possible?


Solution

  • I think you would just need to add the following to change the text direction in cleditor.

    $("#test").cleditor({
                          bodyStyle: "direction:rtl"
                        });