Get Jquery Date-picker value in Java-script Function

Get Jquery Date-picker value in Java-script Function

Dear All,
       I am having a form which consists of html controls(Text-box,dropdown..etc) along with query date-picker control ,As the jquery date-picker control is compatible for all the browsers 
      And I had written the java-script in a function which gets all the values of controls existing in the form ,But I found no luck to get the date-picker value .

Can any one please help me in getting the value of data-picker in function

  1. <!doctype html>
  2. <html lang="en">

  3. <head>
  4.   <meta charset="utf-8">
  5.   <title>click demo</title>
  6.   <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
  7.   <link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
  8.   <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  9.   <script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
  10.   <link rel="stylesheet" href="/resources/demos/style.css">
  11. </head>

  12. <body>
  13.   <p>Date:
  14.     <input type="text" id="datepicker">
  15.   </p>
  16.   <button id="button" type="button">Click Me!</button>
  17.   <script>
  18.    
  19.   function getvalue()
  20.   {
  21.     $("#datepicker").datepicker()
  22.     var x=($("#datepicker").datepicker("getDate"));
  23.      alert(x);
  24.     
  25.   }
  26.   </script>

  27. </body>

  28. </html>


Thanks
SID