chingyawhao / materialize-clockpicker

A materialize clockpicker, demo on
http://chingyawhao.github.io/materialize-clockpicker.html
MIT License
141 stars 69 forks source link

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

Open dbr0 opened 8 years ago

dbr0 commented 8 years ago

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?

chingyawhao commented 8 years ago

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

dbr0 commented 8 years ago

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.