title: How to get the value of text area(tinymce) using jQuery in Moodle?
body: <p>How to get the value of <code>text area(tinymce)</code> using <strong>jQuery</strong> in <strong>Moodle</strong>
  My text area code is:</p>
  
  <pre><code>$editor = \editors_get_preferred_editor();
  $editor-&gt;use_editor("ans");
  echo \html_writer::tag('textarea', '',
      array('id' =&gt; "ans", 'name' =&gt; "ans", 'rows' =&gt; 5, 'cols' =&gt; 5));
  </code></pre>
  
  <p>My <strong>jQuery</strong> code to get the <code>value of editor</code> field is:</p>
  
  <pre><code> var answer = $("#ans").val();
  </code></pre>
  
  <p>But this code is not working, gives nothing.</p>