I just love "jQuery UI DatePicker" as its awesome and so easy to customize. Today for my requirement, I need to show the jQuery UI DatePicker control when textbox gets focus and hide the jQuery UI DatePicker automatically after 2 seconds if date is not selected by the end user, as if the date is selected by the user then DatePicker hides automatically.
jQuery UI DatePicker provides option "show" and "hide" to show/hide the DatePicker. So the idea was to show the DatePicker when textbox gets focus (using focus event) and call setTimeout to hide the datepicker after 2 seconds.
Read How to use jQuery setTimeout function
Feel free to contact me for any help related to jQuery, I will gladly help you.
jQuery UI DatePicker provides option "show" and "hide" to show/hide the DatePicker. So the idea was to show the DatePicker when textbox gets focus (using focus event) and call setTimeout to hide the datepicker after 2 seconds.
Read How to use jQuery setTimeout function
//Code Starts $(document).ready(function() { $('#txtDate').datepicker(); $('#txtDate').focus(function() { $(this).datepicker("show"); setTimeout(function() { $('#txtDate').datepicker("hide"); $('#txtDate').blur(); }, 2000) }) }); //Code EndsSee result below.
Feel free to contact me for any help related to jQuery, I will gladly help you.
No comments:
Post a Comment