Handling the Issue of jQuery UI Datepicker and Dialog Box
- June 6, 2017
- Leave a comment
While developing a jQuery plugin, you must be using some jQuery UI controls. You may encounter an uncommon problem of changing date in a text box which is created in jQuery Dialog box. In this article, you will learn to handle the inconsistency between jQuery UI Datepicker and Dialog box controls.
When you will click on the dialog box for the first time, everything will run fine. But when the dialog box will be opened for the second time, the text box will disappear. This issue occurs due to a bug in the jQuery UI Datepicker control. Unlike to other JQuery UI widgets, “Datepicker does not use widget factory”. That is why it is not triggering “create event”.
No one can expect this issue as both controls (jQuery UI Datepicker and jQuery UI Dialog box) belongs to the same suite. But due to this fact, you and every other programmer can stuck while developing a jQuery plugin.
In order to fix this inconsistency, a little hack is needed. You just need to add a middle layer between these two controls (jQuery UI Datepicker and jQuery UI Dialog box).
In this way, you can resolve this uncommon issue.