attaching jquery function to a span from asp.net code
<p>I am trying to add some jquery to span with a class added to it.
I am using asp.net and trying to use RegisterClientScriptBlock to attach the below code to my element. "cphMain_ed1" is hardcoded in this example however I would normally been passing a parameter here just for the ease of this.</p>

<pre><code>   &lt;script language="javascript" type="text/javascript"&gt;
    $(function () {
        $('.closeButton').click(function () {
            alert('called ok');
            $("cphMain_ed1").slideUp();
        });
    });
&lt;/script&gt;
</code></pre>

<p>My c# code looks like this</p>

<pre><code>  String csName = string.Format("ButtonClickScript_{0}", this.ID);
        Type csType = this.GetType();

        ////// Get a ClientScriptManager reference from the Page class.
        ClientScriptManager cs = Page.ClientScript;
        StringBuilder csText = new StringBuilder();
        // csText.Append("&lt;script  type=\"text/javascript\"&gt; HidePanel('" + this.ID + "')");
        csText.Append("&lt;script  type=\"text/javascript\"&gt;DoIt()");
        csText.Append("&lt;/script&gt;");
        cs.RegisterClientScriptBlock(csType, csName, csText.ToString());
</code></pre>

<p>What am I doing wrong as the function is not been attached to the span with the class "closeButton"</p>

<p>ANy help would be great!!</p>
