datepicker: button options work only with input element? How to display an icon with a datepicker, no input field?

datepicker: button options work only with input element? How to display an icon with a datepicker, no input field?

I am trying to display a button (icon) to click on to display and hide a datepicker. No input field.

Using 1.8.4, this example code works with an INPUT element, but not with a SPAN or DIV (displays the datepicker right away with no button)

$(document).ready(function() {
        $("#datepicker").datepicker(
                {
                 onSelect: function() { alert('onSelect'); },
                 showOn: 'button',
                 buttonImage: 'images/calendar.gif',
                 buttonImageOnly: true
                }
            );
        });

I doesn't work completely with a hidden input either, the datepicker overlaps the button when opened and there is no way to close the datepicker anymore.

Fred