title: Get Value of ASP.NET Control DatePicker in JavaScript
body: <p>I am relatively new to building ASP.NET C# web pages and am just now learning to use controls. </p>
  
  <p>I have a datepicker which is in the form of an ASP Control, and would like to retrieve and use the value in a JavaScript function. Planning to filter a jQuery DataTable based on a date range.</p>
  
  <p>The from and to date HTML input elements are below (in an HTML table):</p>
  
  <pre><code>&lt;tr&gt;
    &lt;td&gt;From:&lt;/td&gt;
    &lt;td&gt;&lt;hei2:HEIDateEdit ID="dateFrom" runat="server" ShowClearButton="true" clientidmode="Static"/&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;tr&gt;
    &lt;td&gt;To:&lt;/td&gt;
    &lt;td&gt;&lt;hei2:HEIDateEdit ID="dateTo" runat="server" ShowClearButton="true" clientidmode="Static"/&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>And I am calling the JS function via <strong>onclick</strong> of an HTML button.</p>
  
  <p>Currently, I'm just trying to use JavaScript's <code>confirm()</code> function to display the date that was selected. The various approaches I've tried have returned <code>undefined</code> and <code>[Object] [object]</code></p>
  
  <p>[Object][object] was displayed when I tried:</p>
  
  <pre><code>function testFunction() {
  var fromDate = $('#dateFrom');
  confirm(fromDate);
  };
  </code></pre>
  
  <p>Update:</p>
  
  <p>It seems that I'm just not accessing the ID attribute of the element correctly. </p>