Getting output from Materialize's timepicker

Viewed 719

I am trying to set up my MaterlizeCSS timepicker to output the time for further processing. The docs don't give any instructions for this, but the pickadate.js docs themselves have instructions.

$('.timepicker').pickatime({
  formatSubmit: 'HH:i',
  hiddenName: true
})

From my understanding, this method should produce a hidden field with the name of the input field and the time in the 24-hr format. It isn't working for me. The name isn't stripped from the original input and the hidden field isn't created. I don't see any errors either. Has anyone else gotten this to work?

For reference, this is my function:

function setTimePicker (elem) {
    elem.pickatime({
        default: 'now', // Set default time: 'now', '1:30AM', '16:30'
        fromnow: 0,       // set default time to * milliseconds from now (using with default = 'now')
        twelvehour: true, // Use AM/PM or 24-hour format
        donetext: 'OK', // text for done-button
        cleartext: 'Clear', // text for clear-button
        canceltext: 'Cancel', // Text for cancel-button
        autoclose: false, // automatic close timepicker
        ampmclickable: true, // make AM PM clickable
        style: {"color": "#ff16a2"},
        formatSubmit: 'HH:i',
        hiddenName: true,
        aftershow: function () {
        } //Function for after opening timepicker
    });
}

EDIT: I've also tried setting the containerHidden option but it didn't do anything either.

0 Answers
Related