jQueryUI 1.8.14 Autocomplete

HTML

<script src="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.14/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://ajax.aspnetcdn.com/ajax/jquery.ui/1.8.14/themes/black-tie/jquery-ui.css">
<input type="text" id="date" />
<button id="button">Button</button>

<input type="text" id="date2" />
<button id="button2">Button2</button>

JavaScript

$.widget("ui.datepicker2", {
    _init: function() {
        var $el = this.element;
        $el.datepicker(this.options);
        
        if (this.options && this.options.trigger) {
            $(this.options.trigger).bind("click", function () {
                $el.datepicker("show");
            });
        }
    }
});


$("#date").datepicker2({
    trigger: "#button"
});


$("#date2").datepicker2({
    trigger: "#button2"
});