maxelcat
maxelcat

Reputation: 1333

use jquery to reset a textarea in tinymce

I am using tinymce and jQuery. In the head of my document I have this:

<script src="jquery/jquery-ui-1.11.4.custom/jquery-ui.js"></script>
<script src="tinymce/js/tinymce/tinymce.min.js"></script>
<script type="text/javascript">
  tinymce.init({
    selector: '#subjectDescriptor',
    toolbar:'code | bold italic | bullist numlist | clear |',
    //menu: {    view: {title: 'View source', items: 'code'}  },
  plugins: 'code'  // required by the code menu item
  });
  </script>

In my html I have a textarea like this: <textarea id="subjectDescriptor"></textarea>

Above this is a select option like so:

<select class="updatetextbox">
<option>1</option>
<option>... etc</option>
</select>

I want the value of the textarea to change (back to blank) when the select option is changed. I have tried various jQuery selector. None of them work though (obviously I change the comments!)

$( ".updatetextbox" ).change(function() {
          $('#subjectDescriptor').setContent($bob);
    //    tinymce.get(subjectDescriptor).setContent('');
    //    $('#subjectDescriptor').html());
}

What am I missing please?

Upvotes: 0

Views: 2504

Answers (1)

Jobelle
Jobelle

Reputation: 2834

tinymce.activeEditor.setContent('');

Upvotes: 4

Related Questions