title: Setting text in Ajax toolkit htmleditorextender on button click event
body: <p>I have been trying to figure this out for most of a day, so any help will be very very welcome...</p>
  
  <pre><code>&lt;body&gt;
  &lt;form id="form1" runat="server"&gt;
  &lt;script type="text/javascript"&gt;
    $(function () {
      ChangeText("This is the changed text from the document ready function");
    });
  
    function ChangeText(newText) {
      var editorControl = $("#txtHTMLEditor");
  
      editorControl[0].value = newText;
    }
  
  &lt;/script&gt;
  &lt;div&gt;
    &lt;ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"&gt;
    &lt;/ajaxToolkit:ToolkitScriptManager&gt;
  
    &lt;div id="divTemp" style="display: block"&gt;
      &lt;asp:TextBox runat="server" ID="txtHTMLEditor" TextMode="MultiLine" Rows="25" Width="100%" Text="&lt;b&gt;This is test text&lt;/b&gt;" /&gt;&lt;br /&gt;
      &lt;ajaxToolkit:HtmlEditorExtender ID="htmlEditorExtender1" TargetControlID="txtHTMLEditor" runat="server" DisplaySourceTab="true"&gt;
      &lt;/ajaxToolkit:HtmlEditorExtender&gt;
    &lt;/div&gt;
  
    &lt;input type="button" onclick="ChangeText('This is the changed text from the button click event'); return false;" value="Perform Change"&gt;
  &lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p></p>
  
  <p>The above code changes the text in the html editor perfectly in the document ready event, but does nothing if I click the button.</p>
  
  <p>Both events fire the same javascript function (ChangeText()), with the value of the text area being changed in both instances, but the change does not show in the text area in the case of the button click event.</p>
  
  <p>Any ideas why not?</p>