InnerHTML attribute empty on span tag during page submit - jQuery/ASP.NET
<p>I have a hidden <code>TextBox</code> control on my page that updates a <code>span</code> tag on the <code>keyup</code> event using jQuery.  When the page is posted back to the server, the <code>innerHTML</code> attribute is empty.</p>

<p>How do I get the value that was set during the <code>keyup</code> event?</p>

<p>Client side code:</p>

<pre><code>&lt;script language="javascript" type="text/javascript"&gt;
    $(document).ready(function(){
        $('#MyHiddenTextBox').keyup(function(){
            if($(this).val().length &gt; 0){
                SetSpanValue();
            }
        });
    });

    function SetSpanValue() {
        var mytext = $('#MyHiddenTextBox').val();
        $('#MySpanTag').html(mytext);
    }
&lt;/script&gt;
&lt;style type="text/css"&gt;
    .USBBox
    {
        position: absolute;
        left: -999em;
    }
&lt;/style&gt;
&lt;asp:TextBox ID="MyHiddenTextBox" runat="server" CssClass="USBBox"  /&gt;
&lt;span id="MySpanTag" runat="server" enableviewstate="true" /&gt;
&lt;asp:Button ID="btnSubmit" runat="server" Text="Submit" OnClick="btnSubmit_Click" /&gt;
</code></pre>

<p>Server side code</p>

<pre><code>protected void btnSubmit_Click(object sender, EventArgs e)
{
    string x = MySpanTag.InnerHtml; //this is coming back empty
}
</code></pre>
