I want to insert a text in p tag returning string tinyMCE through jquery
- by user749884
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.