Passing div to jquery function and get its innerhtml
<p>I have a function to print the content of a div. Let me share my aspx markup.</p>

<pre><code>&lt;div&gt;
&lt;div id="printarea" runat="server"&gt;
&lt;/div&gt;
&lt;asp:Button ID="btnPrint" runat="server" Text="Print Div" OnClick="btnPrint_Click" /&gt;
</code></pre>

<p></p>

<p>In the OnClick event innerhtml is set to the div printarea. The code is: </p>

<pre><code> protected void btnPrint_Click(object sender, EventArgs e)
    {

        string divText = GenerateInPatientBill();// "content you want to print";
        printarea.InnerHtml = divText;

        ScriptManager.RegisterStartupScript(this, Page.GetType(), "script", "PrintDiv(" + printarea.ClientID + ");", true);
    }
</code></pre>

<p>I need to pass the clientid of printarea div to the javascript function and get it printed. The javascript function used is</p>

<pre><code> function PrintDiv(printarea1) {
    alert($("#" + printarea1 + ""));
    var printContent = $("#" + printarea1 + "").html();
    alert(printContent);
    var popupWin = window.open('', '_blank', 'width=300,height=400,location=no,left=200px');
    popupWin.document.open();
    popupWin.document.write(printContent);
    popupWin.document.close();
    popupWin.focus();
    popupWin.print();
    popupWin.close();
}
</code></pre>

<p>Am getting javascript syntax error at line 2. Please help me on this.</p>
