Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

value is not changing #41

Closed
airrooms opened this issue Feb 22, 2022 · 4 comments
Closed

value is not changing #41

airrooms opened this issue Feb 22, 2022 · 4 comments

Comments

@airrooms
Copy link

Hi I used onAudjust and also try onChange to change the value. but value on changing. can you plaese help.

onAdjust: function(newVal, oldVal) {

return $(this).attr('value');
}

@loebi-ch
Copy link
Owner

Hi @RoomLea

What exactly do you try to achieve? I cannot follow you...

onAdjust is an event that's fired every time the clock's value is changing
onChange is an event that's fired every time the clock's value has been changed

If you want to set the clock's value, you have to use the following method:

$('.your-time-field').clockTimePicker('value', '08:00');

@airrooms
Copy link
Author

2022-02-23_1-41-38

check this image value still same how to get new time value?

@loebi-ch
Copy link
Owner

loebi-ch commented Feb 22, 2022

The value in HTML is only the initial value for the ClockTimePicker.

You can register the onchange event in HTML:

<input class="time" type="text" ... onchange="console.log('Time changed to: ' + this.value)" />

or you can register the onChange or onAdjust event in the ClockTimePicker's configuration:

$('.time').clockTimePicker({
   onChange: function(newVal, oldVal) { console.log('Value changed from ' + oldVal + ' to ' + newVal + '.'); },
   onAdjust: function(newVal, oldVal) { console.log('Value adjusted from ' + oldVal + ' to ' + newVal + '.'); }
});

or you can simply call:

$('.time').val()

@loebi-ch
Copy link
Owner

I've just released a new version (2.6.0) that also updates the HTML value attribute upon time change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants