materialize-clockpicker icon indicating copy to clipboard operation
materialize-clockpicker copied to clipboard

jquery `on change` isn't triggered - trying to validate input

Open dbr0 opened this issue 8 years ago • 2 comments

My HTML:

<input id="start_time" type="time">

My jquery script:

            $('#start_time').pickatime({
                autoclose: false,
                twelvehour: true
            });

And this is only triggered when I select the time for the first time:

        $(document).on('change','#start_time',function(){ 
            console.log('changed');
        });

When I change the time to something else changed is not logged to console.

Am I missing something basic here or is this a desired behaviour? How do I proceed with checking if the time has changed?

dbr0 avatar Aug 16 '16 18:08 dbr0

Try this... $('#start_time').change(function() { console.log('changed'); });

chingyawhao avatar Aug 17 '16 04:08 chingyawhao

Nope still nothing. Let me try to create jsfiddle. Update: I tried and I failed: https://jsfiddle.net/ab7zLdxu/1/

ps Regarding my example in first post. I have multiple different input elements on which the code above $(document).on() works nicely. It's just the timepicker that doesn't register the change.

dbr0 avatar Aug 17 '16 09:08 dbr0