lawrencepit / jquery_jeditable forked from tuupola/jquery_jeditable

jQuery edit in place plugin. Extendable via plugin architecture. Plugins for plugin. Really.

This URL has Read+Write access

jquery_jeditable / jquery.jeditable.timepicker.js
100644 34 lines (31 sloc) 1.06 kb
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
/*
* Timepicker for Jeditable
*
* Copyright (c) 2007-2008 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$
*
*/
 
$.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').timepicker();
    }
});