Dynamically adding TinyMCE editor to textbox

I am adding textboxes dynamically to a div. Something likhe this

$('#xyz').click(function()
{
     $(#myDiv).append('<textarea></textarea>');
});

Now I want to attach tinymce editor to these textareas, Can you help me in doing this?

Answers


Try this:

$('#xyz').click(function() {
    var myTextarea = $("<textarea></textarea>");
    myTextarea.attr("id", "mce-editor");
    $("#myDiv").append(myTextarea);

    // this inistalises the TinyMCE editor upon the element with the id in the last parameter.
    tinyMCE.execCommand("mceAddControl", false, "mce-editor");
});

Need Your Help

How would you get an auto_increment value on an insert query?

php mysql codeigniter

So, I was wondering if you were to launch this query:

Angular ng-submit only allow function in scope

javascript html angularjs html5 submit

In angular js , does html have access to functions not define in $scope ?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.