forked from NicolasCARPi/jquery_jeditable
-
Notifications
You must be signed in to change notification settings - Fork 1
/
jquery.jeditable.timepicker.js
35 lines (34 loc) · 1.14 KB
/
jquery.jeditable.timepicker.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/*
* Timepicker for Jeditable
*
* Copyright (c) 2007-2009 Mika Tuupola
*
* Licensed under the MIT license:
* http://www.opensource.org/licenses/mit-license.php
*
* Depends on Timepicker jQuery plugin by Jason Huck:
* http://jquery.com/plugins/project/timepicker
*
* Project home:
* http://www.appelsiini.net/projects/jeditable
*
* Revision: $Id$
*
*/
var timepickerFormId = 0
$.editable.addInputType('timepicker', {
/* This uses default hidden input field. No need for element() function. */
/* Call before submit hook. */
submit: function (settings, original) {
/* Collect hour, minute and am/pm from pulldowns. Create a string from */
/* them. Set value of hidden input field to this string. */
var value = $('#h_').val() + ':' + $('#m_').val() + "" + $('#p_').val();
$('input', this).val(value);
},
/* Attach Timepicker plugin to the default hidden input element. */
plugin: function(settings, original) {
$('input', this).filter(':hidden')
.attr("id", "jquery_timepicker_"+(++timepickerFormId))
.filter(':hidden').timepicker();
}
});