I have a button (".next") and a dropdown ("#page\_num"). The dropdown (jquery UI selectmenu) has the following function attached. 

```
    $("#page_num").selectmenu ({
        width: 40,
        change:function( event,ui ) {
            search ();
        }
    });;

```

I have the following code where button click causes the dropdown to change to the next option.

```
    $("#next").button();
    $('#page_num').selectmenu();

    $('#next').click(function() { 

        if($("#page_num :selected").index() != $("#page_num option:last-child").index()){
            $("#page_num").val($("#page_num :selected").next().val());
            $('#page_num').selectmenu('refresh', true);
        } else {
            $("#page_num").val($("#page_num option:first-child").val());
            $('#page_num').selectmenu('refresh', true);
        }
    });      

```

My problem is that I cannot seem to integrate the former code into the latter. I want the dropdown menu to pass the function "search()" every time the .next button is clicked but have not been able to get this to work. 
Can anyone shed any light on this? 

Thanks