【问题标题】:jQuery UI Multiselect Next - onChangejQuery UI 多选 Next - onChange
【发布时间】:2012-09-12 13:58:06
【问题描述】:

我有 jQuery UI Multiselect Next http://quasipartikel.at/multiselect_next I want to fire an event whenever the selection changes in any way.

这个例子不起作用:

$('#countries').change(function() {
alert('Hi');
});

所以基本上,如何在任何选择更改时触发事件?

谢谢。

【问题讨论】:

    标签: jquery jquery-ui select multi-select


    【解决方案1】:

    提供一个反馈函数来处理选定的事件作为一个初始化选项。

    $('.selector').multiselect({ selected: function(event, ui) { alert($(ui.option).val() + " has been selected"); } });
    
    $('.selector').multiselect({ deselected: function(event, ui) { alert($(ui.option).val() + " has been deselected"); } });
    

    绑定到多选选择类型的选定事件。

    $('.selector').bind('multiselectselected', function(event, options) {
      ...   // ui.option is the DOMOption node of ui.sender
    });
    
    $('.selector').bind('multiselectdeselected', function(event, ui) {
      ...   // ui.option is the DOMOption node of ui.sender
    });
    

    【讨论】:

      【解决方案2】:

      试试

      $('#countries').mouseleave(function() {
       alert('Hi');
      });
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多