How To Bind A JQueryUI SelectMenu Widget To KnockOut

[1 minute read]

Answer: data-bind=event: {selectmenuchange: [your-viewModel-function]}

I initially assumed change would be the correct event to bind to. Nope. Turns out you have to use selectmenuchange. I pieced that together after finding this issue on GitHub. Of course, that guy was trying to use a value binding, so the scenario wasn’t exactly the same. I wanted to receive notifications whenever the value of the select menu option changed. But it at least put me on the path toward using the correct event. Here’s a quick demo I put together that shows how to do it.