Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#8738 closed bug (worksforme)

Spinner does not fire change event.

Reported by: [email protected] Owned by:
Priority: minor Milestone: 1.10.0
Component: ui.spinner Version: 1.9.1
Keywords: Cc:
Blocked by: Blocking:


The API states that the spinner should fire the change event when it looses focus, as far as I can tell, it does not do so. Furthermore, I believe it should fire the change vent when it changes (on after arrow click for example), or at least that this should be an option. Example here:

I'm attempting to use spinner with KnockoutJS, because the change event is not getting triggered my observable in the viewModel is not getting updated and therefore data is not getting changed. This makes spinner useless with any libraries that utilize this behavior.

Change History (10)

comment:1 Changed 10 years ago by Scott González

Resolution: worksforme
Status: newclosed

It trigger the spinner's change event, which has an event type of spinchange. The new documentation site doesn't currently include the event types, but we're working on that:

comment:2 Changed 10 years ago by [email protected]

I guess I'm not understanding. The sample on jsFiddle I included clearly doesn't work. If a custom change event is the only thing it fires, how am I suppose to get that to work with KncokoutJS?

To fix my issue I've edited my local jQueryUI 1.9.1, line 10824 in the _value: event, adding the following towards the bottom.


Full _value function

update the value without triggering change _value: function( value, allowAny ) {

var parsed; if ( value !== "" ) {

parsed = this._parse( value ); if ( parsed !== null ) {

if ( !allowAny ) {

parsed = this._adjustValue( parsed );

} value = this._format( parsed );


} this.element.val( value ); this._refresh();

Added by Dave Sargent dsargent to fix KnockoutJS observable not changing issue.



comment:3 Changed 10 years ago by Scott González

This is not the place to ask for help with KnockoutJS integration. Please use the forums or StackOverflow.

comment:4 Changed 10 years ago by [email protected]

Wow, how amazingly unhelpful of you. If you want your users to actually help you try and improve jQuery UI I suggest you try not being so rude when they do so. It's really unprofessional.

What I'm trying to explain is that as a developer, I would expect that the value of the text box changing would cause the change event to fire. This is how the DOM is supposed to work. The spinner doesn't do that, I call that a bug. Period.

I then ask you how it's supposed to work and get a pissy response, very uncool.

comment:5 Changed 10 years ago by Corey Frang

I'm pretty sure he wasn't being pissy. This is our bug tracker, not a support forum. Please check with the forums, IRC, StackOverflow, etc.

Last edited 10 years ago by Corey Frang (previous) (diff)

comment:6 Changed 10 years ago by ryanneufeld

FYI, The spinner (as most jquery ui widgets do) as several of it's own events that you can bind to.

For example:

Unless I'm mistaken, that's a change event. Enjoy :)

If you find any problems with this event. Please feel free to file another bug report. Alternatively you can use the forum and our very active IRC channels for help.

Thank-you for your contribution.

Last edited 10 years ago by ryanneufeld (previous) (diff)

comment:7 Changed 10 years ago by [email protected]

Ryan, thank you that was a very nice response. I got it working, here's a sample:

But again, this ticket wasn't about me getting help getting this to work, which I agree this is not the place, but about what I feel is the bug that when the text is changed the main DOM change event for that textbox is not fired. i.e. I shouldn't have to subscribe to a specific jQuery UI change even when there already is one for the textbox which appears to be blocked. I guess there is some reason as to why you want to do this? If so, that would be a GREAT addition to the documentation.

comment:8 Changed 10 years ago by Scott González

Sure, we can add a note about this in the documentation. We'll need to add it to every widget that builds on form elements.

comment:9 Changed 10 years ago by [email protected]

Scott, thank you, that would be helpful. One other suggestion is to have examples for in the examples area that show how to use the events. To my knowledge there aren't any there for any of the widgets and I'm thinking it's probably one of the bigger stumbling blocks for newer JS developers. Also, can you answer my question as to why the built in change event isn't fired? Is it a design decision? Where there tough technical challenges etc.? I think explaining int he docs as to why would save allot of frustration.

Thanks again.

comment:10 Changed 10 years ago by Scott González

It's a design decision. We don't want to guarantee native functionality for enhanced widgets. It's a pain to do and generally not very useful. The meaning of the native change event is in fact preserved, as we don't do anything to prevent it. It never fires because the value is set programmatically, not by the user.

As for examples of events, they're coming. You'll notice we've already got the example for options added, methods are on their way, and events will come after that.

Note: See TracTickets for help on using tickets.