Unable to get handleIndex of jQuery Slider on change

Unable to get handleIndex of jQuery Slider on change

Hi, I have slider with 2 handles. I want to get which handle was changed. I see in jQuery documentation that we can use change event and then ui object to get handleIndex. I have seen the examples. They work fine. 

But with my slider, it is not. Here is my slider:

  1. var slider = $("#slider").slider(
    {
    id: "slider1",
    min: 0,
    max: 40000,
    step: 100,
    value: [${val1}, ${val2}]
    }
    ).on('slide', function ( event, ui ) {
    //
    some work here.
    }).on('change', function ( event, ui ) {

    // This below line does not work for me.

        // says ui object is undefined
     var index = $(ui.handle).index();
    console.log("ind: " + index);
    })
    .
    data('slider');