diff options
author | Emil Lundberg <lundberg.emil@gmail.com> | 2014-05-11 23:13:11 +0200 |
---|---|---|
committer | Emil Lundberg <lundberg.emil@gmail.com> | 2014-05-12 00:51:28 +0200 |
commit | 66ba807e1bc3c13212f7481464a9ff1f56b73649 (patch) | |
tree | 10e0b1e67a2da50c81d5b57672a8f5faf4983d0b /src/jquery-ui-timepicker-addon.js | |
parent | a792358ac178fe673fbecd8c7d640328e3a795d7 (diff) | |
download | jQuery-Timepicker-Addon-66ba807e1bc3c13212f7481464a9ff1f56b73649.zip jQuery-Timepicker-Addon-66ba807e1bc3c13212f7481464a9ff1f56b73649.tar.gz jQuery-Timepicker-Addon-66ba807e1bc3c13212f7481464a9ff1f56b73649.tar.bz2 |
Add altRedirectFocus option
If set to true (default), the altField will redirect focus to the main
field (this is how it always worked before this change). Otherwise, the
altField will not redirect its focus, and the altField will behave as a
normal text field that can be edited by the user.
Diffstat (limited to 'src/jquery-ui-timepicker-addon.js')
-rw-r--r-- | src/jquery-ui-timepicker-addon.js | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/jquery-ui-timepicker-addon.js b/src/jquery-ui-timepicker-addon.js index a6028da..29209c9 100644 --- a/src/jquery-ui-timepicker-addon.js +++ b/src/jquery-ui-timepicker-addon.js @@ -99,6 +99,7 @@ altTimeFormat: null, altSeparator: null, altTimeSuffix: null, + altRedirectFocus: true, pickerTimeFormat: null, pickerTimeSuffix: null, showTimepicker: true, @@ -271,11 +272,14 @@ tp_inst.$input = $input; if (tp_inst._defaults.altField) { - tp_inst.$altInput = $(tp_inst._defaults.altField).css({ - cursor: 'pointer' - }).focus(function () { - $input.trigger("focus"); - }); + tp_inst.$altInput = $(tp_inst._defaults.altField); + if (tp_inst._defaults.altRedirectFocus === true) { + tp_inst.$altInput.css({ + cursor: 'pointer' + }).focus(function () { + $input.trigger("focus"); + }); + } } if (tp_inst._defaults.minDate === 0 || tp_inst._defaults.minDateTime === 0) { |