summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEmil Lundberg <lundberg.emil@gmail.com>2014-05-11 23:13:11 +0200
committerEmil Lundberg <lundberg.emil@gmail.com>2014-05-12 00:51:28 +0200
commit66ba807e1bc3c13212f7481464a9ff1f56b73649 (patch)
tree10e0b1e67a2da50c81d5b57672a8f5faf4983d0b /src
parenta792358ac178fe673fbecd8c7d640328e3a795d7 (diff)
downloadjQuery-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')
-rw-r--r--src/docs/options.html3
-rw-r--r--src/jquery-ui-timepicker-addon.js14
2 files changed, 12 insertions, 5 deletions
diff --git a/src/docs/options.html b/src/docs/options.html
index 3cecb5a..22fc123 100644
--- a/src/docs/options.html
+++ b/src/docs/options.html
@@ -68,6 +68,9 @@
<dt>altTimeFormat</dt>
<dd><em>Default: (timeFormat option)</em> - The time format to use with the altField.</dd>
+
+ <dt>altRedirectFocus</dt>
+ <dd><em>Default: true</em> - Whether to immediately focus the main field whenever the altField receives focus. Effective at construction time only, changing it later has no effect.</dd>
</dl>
<h3>Timezone Options</h3>
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) {