Last Reply on Dec 19, 2011 10:43 PM By Adnaan
Posted on Dec 19, 2011 10:40 PM

I am referring to

http://www.jqueryfaqs.com/Questions/Trigger-jQuery-UI-DatePicker-with-Image-Icon.aspx

I want to attach date select event handler to the jQuery UI DatePicker

 

Posted on Dec 19, 2011 10:41 PM

check this. Click demo button to see it working

 

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js" type = "text/javascript"></script>
    <script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js" type = "text/javascript"></script> 
    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel = "Stylesheet" type="text/css" /> 
    <script type = "text/javascript">
        $(function () {
            $("#txtDate").datepicker({
                onSelect: function (date, obj) {
                    alert("You selected: " + date);
                },
                showOn: 'button',
                buttonImageOnly: true,
                buttonImage: 'http://jqueryui.com/demos/datepicker/images/calendar.gif'
            });
        });
    </script>
</head>
<body>
    <form id="form1">
      <input type = "text" id = "txtDate" />
    </form>
</body>
</html>

Demo