Permalink
Browse files

Fix #44 add the destroy method. $('#inputId').timepicker('destroy');

  • Loading branch information...
1 parent 398b8d5 commit 0022bdb57f4b22a260f1526888afc5bd67ddc982 @fgelinas committed Jul 19, 2012
Showing with 20 additions and 0 deletions.
  1. +20 −0 jquery.ui.timepicker.js
View
@@ -809,6 +809,26 @@
},
+ /* Detach a timepicker from its control.
+ @param target element - the target input field or division or span */
+ _destroyTimepicker: function(target) {
+ var $target = $(target);
+ var inst = $.data(target, PROP_NAME);
+ if (!$target.hasClass(this.markerClassName)) {
+ return;
+ }
+ var nodeName = target.nodeName.toLowerCase();
+ $.removeData(target, PROP_NAME);
+ if (nodeName == 'input') {
+ inst.append.remove();
+ inst.trigger.remove();
+ $target.removeClass(this.markerClassName)
+ .unbind('focus.timepicker', this._showTimepicker)
+ .unbind('click.timepicker', this._adjustZIndex);
+ } else if (nodeName == 'div' || nodeName == 'span')
+ $target.removeClass(this.markerClassName).empty();
+ },
+
/* Enable the date picker to a jQuery selection.
@param target element - the target input field or division or span */
_enableTimepicker: function(target) {

0 comments on commit 0022bdb

Please sign in to comment.