title: How to get current date on page load using JQuery UI datepicker?
body: <p>Hi all i am new to JQuery UI, i know how to get current date on page load using JQuery date picker, but i am not able to do same thing in this code.</p>
  
  <p>Using this we can get current date on page load.</p>
  
  <pre><code>$(function() {
          $("#datepicker").datepicker();
          $("#datepicker").datepicker("setDate", new Date);
      });
  </code></pre>
  
  <p>But i want same this functionality with persisting of the below one how can i gett that using below code.</p>
  
  <pre><code>&lt;!doctype html&gt;
  
  &lt;html lang="en"&gt;
  &lt;head&gt;
    &lt;meta charset="utf-8" /&gt;
    &lt;title&gt;jQuery UI Datepicker - Select a Date Range&lt;/title&gt;
    &lt;link rel="stylesheet" href="http://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" /&gt;
    &lt;script src="http://code.jquery.com/jquery-1.9.1.js"&gt;&lt;/script&gt;
    &lt;script src="http://code.jquery.com/ui/1.10.3/jquery-ui.js"&gt;&lt;/script&gt;
    &lt;link rel="stylesheet" href="/resources/demos/style.css" /&gt;
    &lt;script&gt;
    $(function() {
      $( "#from" ).datepicker({
        defaultDate: "+1w",
        changeMonth: true,
        numberOfMonths: 3,
        onClose: function( selectedDate ) {
          $( "#to" ).datepicker( "option", "minDate", selectedDate );
        }
      });
      $( "#to" ).datepicker({
        defaultDate: "+1w",
        changeMonth: true,
        numberOfMonths: 3,
        onClose: function( selectedDate ) {
          $( "#from" ).datepicker( "option", "maxDate", selectedDate );
        }
      });
    });
    &lt;/script&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;label for="from"&gt;From&lt;/label&gt;
  &lt;input type="text" id="from" name="from" /&gt;
  &lt;label for="to"&gt;to&lt;/label&gt;
  &lt;input type="text" id="to" name="to" /&gt;
  
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>