[JQuery Slider] Set slider handle position after slide event

[JQuery Slider] Set slider handle position after slide event

Hi,

I am working on a problem whereby I have a slider and when the user moves the slider, it will snap to the nearest integer in an array of discrete integers, for example [18,35,40,83].
I have the following slide event code:
  1. slide: function(event, ui) {
        $("#slider_a").val(getNearestValue(ui.value));
        $("#slider_s").slider('option', 'value', getNearestValue(ui.value));
    }


The algorithm getNearestValue() is working fine and returns the correct value, and the value displayed onscreen is being updated correctly, however, I cannot set the location of the handle once the user has finished selection. I thought .slider('option', 'value', x) would accomplish this but it doesn't seem to have any affect.

Any help much appreciated.