title: Why does the javascript line have to be in a function to work?
body: <p>If I put this javascript on my aspx page, the panel shows as expected upon button click:</p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
   function ShowPopUp() {
       $('#&lt;%= upNewClient.ClientID %&gt;').show();
   }
   &lt;/script&gt;
  
   &lt;asp:Button ID="btnNewClient" runat="server" OnClientClick="javascript: ShowPopUp(); return false;" /&gt;
  </code></pre>
  
  <p>But if I try to do this w/o the function, it doesn't work:</p>
  
  <pre><code>&lt;asp:Button ID="btnNewClient" runat="server" OnClientClick="javascript: $'(%&lt;= upNewClient.ClientID %&gt;'.show(); return false;"/&gt;
  </code></pre>
  
  <p>The page flashes and there might be an error appearing in my javascript console, but it comes and goes too quickly for me to read it. </p>
  
  <p>So, why doesn't the exact same line of code work outside of the function?</p>
  
  <p><strong>EDIT:</strong>
  I've rewritten this code several times (I'm actually trying to do it in the code behind), and I mistyped it the time just before my initial posting.  The actual button tag is:</p>
  
  <pre><code>&lt;asp:Button ID="btnNewClient" runat="server" Text="Add New Client" OnClientClick="javascript: $('#&lt;%= upNewClient.ClientID %&gt;').show(); return false;" /&gt;
  </code></pre>
  
  <p>This flashes an error in my javascript console very quickly that I believe says:
  Uncaught Error: Syntax error, unrecognized expression: #&lt;%= upNewClient.ClientID %> </p>