I need to make the jQuery work with the rest of the js and display the date in descending order on a chart. This is the basis of what I have so far. Where it says "document.write(x);" I need it to display the date that is picked by the user.
 <script src="//code.jquery.com/jquery-1.10.2.js"></script>
  <script src="//code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
  <link rel="stylesheet" href="/resources/demos/style.css">
        <style>
            h1 {
                text-align: center;
            }
        </style>
    </head>
    <body>
    <div class="datepicker">
        <div>
            <script type="text/javascript">
            var x;
            $(function date() {
              $("#datepicker").datepicker({
                  onClose: function(dateText) {
                     var x = dateText;
                     alert("x = " + x);
                  }
                });
              $('#datepicker').datepicker('option', {dateFormat: 'mm/dd/yy'});
          });
            </script>
  <input type="text" id="datepicker">
        </div>
    </div>
<div class="price-chart">
    <div class="attr-col">
        <ul>
            <li>Service 1:</li>
            <li>Service 2:</li>
            <li>Service 3:</li>
            <li>Service 4:</li>
            <li>Service 5:</li>
        </ul>
    </div>
    <div class="pt-table">
        <div class="pt-body">
            <ul class="pt-rows">
                <li class="title">
                <span><script type="text/javascript">
                document.write(x);
                </script></span>
 
     
    