I'm creating a repeatable meta box using this code below. how can i add a wysiwyg editor in this textarea field . any help is very much appreciated
How to create meta box using clone ajax and jquery in wordpress
Thanks
I'm creating a repeatable meta box using this code below. how can i add a wysiwyg editor in this textarea field . any help is very much appreciated
How to create meta box using clone ajax and jquery in wordpress
Thanks
It is an old question but maybe someone else might need it, so here is how you do it:
<textarea id="tag-description"></textarea>
First let the document load, then check if tinyMCE present and initialize the editor.
jQuery(document).ready(function() {
if ( typeof( tinyMCE ) == "object") {
tinyMCE.init({
selector: '#tag-description'
});
}
});
Add the class 'theEditor' to your textarea.
<textarea class=”theEditor” name=’blurb’ id=’blurb’></textarea>
Edit:
You can also add editor with js
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery("#blurb").addClass("mceEditor");
if ( typeof( tinyMCE ) == "object" &&
typeof( tinyMCE.execCommand ) == "function" ) {
tinyMCE.execCommand("mceAddControl", false, "blurb");
}
});
</script>
<textarea class="" name='blurb' id='blurb'></textarea>