From 239325e42ae3993a56cd2e56fd7d98bb6bc782fa Mon Sep 17 00:00:00 2001 From: Constantin GALBENU Date: Fri, 22 Jan 2016 15:48:30 +0200 Subject: [PATCH] added the clear button --- js/bootstrap-timepicker.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/js/bootstrap-timepicker.js b/js/bootstrap-timepicker.js index bbb923c5..fd09c060 100644 --- a/js/bootstrap-timepicker.js +++ b/js/bootstrap-timepicker.js @@ -33,6 +33,7 @@ this.icons = options.icons; this.maxHours = options.maxHours; this.explicitMode = options.explicitMode; // If true 123 = 1:23, 12345 = 1:23:45, else invalid. + this.clearText = options.clearText;//the text (if any) to show the clear button this.handleDocumentClick = function (e) { var self = e.data.scope; @@ -98,6 +99,7 @@ 'keyup.timepicker': $.proxy(self.widgetKeyup, self) }); }); + this.$widget.find('.timepicker-empty-btn').on('click', $.proxy(this.clear, this)); } this.setDefaultTime(this.defaultTime); @@ -325,7 +327,8 @@ '' : '') + ''+ - ''; + '' + + (this.clearText ? '' + this.clearText + '' : ''); switch(this.template) { case 'modal':