I want to insert a text in p tag returning string tinyMCE through jquery

Posted by user749884 on Stack Overflow See other posts from Stack Overflow or by user749884
Published on 2012-07-05T09:06:34Z Indexed on 2012/07/05 9:15 UTC
Read the original article Hit count: 142

Filed under:

I want to insert a text in last p tag which is returning from tinyMCE by the following code

    var html = tinyMCE.activeEditor.getContent();
For this I am using the following jquery code

tinyMCE.init({
               mode : "textareas",
               theme : "advanced"
       });

       $(document).ready(function(){
   $("a[title='click_to_add']").click(function() {
               var html = tinyMCE.activeEditor.getContent();
               html = $("#p:last").text();
               alert(html);

               name = $(this).html();

               content = html+" "+name;

               tinyMCE.activeEditor.setContent(content);
               return false;
               });
       });

But it is not working.The HTML code is given below

<div style="float:left;">
       <textarea id="mail_body" name="mail_body" rows="15" cols="80" style="width:575px;"></textarea>

       </div>
       <div id="aaa">
           <a href="#" id="news_user" title="click_to_add"> < name > </a>
   </div>

Please give us a solution for this problem.

© Stack Overflow or respective owner

Related posts about jQuery