Insert text to cursor position in rich:editor when click button by Javascript -


I use javascript to insert some text on cursor position in rich: editor , But this is not

You can see this clearly in this picture:

This code is:

    << h: inputText> <<< s: Decorating & gt; & lt; s: Decorating id =" ButtonCharacter "Template =" Layout / Edit Xhtml ">   function changes () {// var val = document.getElementsByClassName ("subject"); Var Val = document.getElementById ("# {Rich: Customer ID ('Editor')}"); If (val! = Null) {var value = val.getValue (); Var position = Value.lice (0, Wall. The choice Not selected) Length; Var result = value.substr (0, position) + "{chuc_vu}" + value.substr (position); Document.getElementById ("# {Rich: Customer ID ('Editor')}" ) Value = result;}}    

If I change the function change With the h: input text then it works fine. When I debug in Firefox with firebug , I can not get rich in : editor .

This line of code shows by value as undefined :

  var value = val. GetValue ();   

whenever I change the text from "{chuc_vu}" "# {chuc_vu}" ), so that it is empty text Via Firebug). How can I include text in rich: Editor

is not the editor You should use the Javascript API to handle just a simple text component, where available.

  document.getElementById ("# {Rich: clientId ('editor')}");   

$ ("# {Rich: Customers ID ('Editor')} "). Element, value = component. TMC_editor.gate content ();

To set the content, use setContent () . Note that markup should be in the text, which means your ccccccccccccccccccc will be & lt; P & gt; Ccccccccccccccccc & lt; / P & gt;

Comments

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -