且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用jquery获取选择菜单onChange中的选项值?

更新时间:2023-01-20 15:08:17

根据 ScrollectBox ,你必须使用 onSelectEvent 属性,如下所示:

According to the source code for ScrollectBox, you must use the onSelectEvent property, like so:

jQuery(document).ready(function($){ 
    $(".selection").scrollectBox({
        preset: 'dropdown',
        numVisibleOptions: 4,
        scrollInterval: 150, 
        scrollOn: 'hover',
        onSelectEvent: function (item, event) {
           alert(item.val());
        }
    });
});