HTMLEditor (From AJAXToolkit) Check if content is empty
<p>I have an HTMLEditor in my aspx file with id = "txtText"</p>

<p>I am trying to write a JQuery function which checks if the content of the editor is empty.</p>

<p>I originally had:</p>

<pre><code>function check()
{
    if($('#txtText').val() == '')
    {
         return false;
    }
    return true
}
</code></pre>

<p>However when I added an alert box to find out why this doesn't work. I realized that the .val() property of the HTMLEditor is always undefined (whether the editor has text or has no text).</p>

<p>I tried using $('#txtText').content(), which is how I am accessing the data in the code-behind(C#), but that does not seem to work in JQUERY.</p>

<p>After doing some research I found this site: <a href="http://forums.asp.net/t/1549543.aspx/1" rel="nofollow">http://forums.asp.net/t/1549543.aspx/1</a></p>

<p>I have very smiliar code, such that I also made my own custom editor which inherits from the one in AJAXToolkitEditor.</p>

<pre><code>&lt;cc1:CustomEditor ID="txtEditor" Height="600px" runat="server" /&gt;
&lt;asp:Label ID="Label1" runat="server" Text="Label"&gt;&lt;/asp:Label&gt;
&lt;asp:Button ID="Button1" OnClientClick="getImageContent()"
    runat="server" Text="Button" OnClick="saveContent" /&gt;
&lt;asp:HiddenField ID="HiddenField1" runat="server" /&gt;
</code></pre>

<p>The posted code does not work for me:</p>

<pre><code>function getImageContent() {
var editor = $find("txtEditor");
var editPanel = editor.get_editPanel();
var designPanel = editPanel.get_modePanels()[0];
var s = designPanel.get_content();

document.getElementById("HiddenField1").value = s;
</code></pre>

<p>}</p>

<p>The line var editor = $find("txtEditor") is a null value.</p>
