title: JQuery: how to get the value of an ID from Master/Content page in ASP.NET
body: <p>i have this in my content page: but i am getting null value if  i try  <code>$("#ctl00_cphMaster_CloseButton").</code></p>
  
  <pre><code>$(document).ready(function() {
      $("#ctl00_cphMaster_CloseButton").click(function() {
              jConfirm('Can you confirm this?', 'Confirmation Dialog', function(r) {
                  if (r == true)
                      __doPostBack('CloseButton', '');
              });
              return false;
          });
      });
  });
  
  &lt;uc1:ImageTextButton ID="CloseButton" runat="server" 
              ImageURL="Images/closeIcon.png"
              Enabled="True" Text="Close" 
              CausesValidation="false" onclick="CloseButton_Click" /&gt;
  </code></pre>
  
  <p>UPDATE:</p>
  
  <p>i have tried like this:</p>
  
  <pre><code>$("#&lt;%= CloseButton.ClientID %&gt;").click(function() {
  
          jConfirm('Can you confirm this?', 'Confirmation Dialog', function(r) {
              if (r == true)
                  __doPostBack('CloseButton', '');
          });
          return false;
      });
  });
  </code></pre>
  
  <p>when i run my page it throws me an error with this code:</p>
  
  <pre><code>$("#ctl00_cphMaster_CloseButton").click(function() {
  
          jConfirm('Can you confirm this?', 'Confirmation Dialog', function(r) {
              if (r == true)
                  __doPostBack('CloseButton', '');
          });
          return false;
      });
  </code></pre>
  
  <p>it means it got the right id but why is it throwing an error complaining about null</p>
  
  <p><strong>Microsoft JScript runtime error: 'null' is null or not an object</strong></p>
  
  <p>UPDATE:</p>
  
  <p>KP Suggestion:</p>
  
  <pre><code>$("#&lt;%= CloseButton.ClientID %&gt;").click(function() { 
               alert("yes");
         }); 
  });
  </code></pre>