validasi datepicker button

datepicker select and button disabled

HTML

<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<p>Date: <input type="text" id="datepicker"></p>
 <button id="btn" type="submit">simpan</button>

JavaScript

$(function () {
                $('#btn').prop('disabled', true);
                $("#datepicker").datepicker({
                    onSelect: function (dateText, inst) {
                        $('#btn').removeAttr('disabled');
                    }
                });
            });