I can only assume we use gelatine with liquids (or at least the majority of time it's to set a liquid - unless anyone uses it for other reasons?) - so why soak it first? And why do we then squeeze it? I would assume it's to get rid of something but my searches return no results.


Question: jQueryUI Spinner widget with knockout
Answer: The best way is to create custom binding to bind spinner to the input:

ko.bindingHandlers.spinner = {
    init: function(element, valueAccessor, allBindingsAccessor) {
        //initialize datepicker with some optional options
        var options = allBindingsAccessor().spinnerOptions || {};
        $(element).spinner(options);

        //handle the field changing
        ko.utils.registerEventHandler(element, "spinchange", function () {
            var observable = valueAccessor();
            observable($(element).spinner("value"));
        });

        //handle disposal (if KO removes by the template binding)
        ko.utils.domNodeDisposal.addDisposeCallback(element, function() {
            $(element).spinner("destroy");
        });

    },
    update: function(element, valueAccessor) {
        var value = ko.utils.unwrapObservable(valueAccessor()),
            current = $(element).spinner("value");

        if (value !== current) {
            $(element).spinner("value", value);
        }
    }
};


And then just use it instead of value binding:

&lt;input
    type="number"
    style="width: 100px;"
    data-bind="spinner: Price, spinnerOptions: { min: 0 } " /&gt;


Here is working fiddle: http://jsfiddle.net/vyshniakov/SwKGb/