首页 > 解决方案 > bootstrap-fullscreen-select 触发 onchange 事件?

问题描述

我正在使用全屏选择选项http://craftpip.github.io/bootstrap-fullscreen-select/ 它不能触发 onchange 事件,知道吗?

<select name="select_year" id="select_year" class="form-control mobileSelect">
   <option value='abc'> abc </option>
</select>

$(document).ready(function()
{
    $('#select_year').on('change', function() {
         alert( "asdaS" );
    })
});

感谢@Justinas。我成功触发了 onchange 事件。这是我所做的:

添加以下代码:

onClose: function(){
    alert('onClose: '+$(this).val());
},
onOpen: function(){
    alert('onOpen: '+this.val());
}

里面 :

$('.mobileSelect').mobileSelect({
    animation: 'scale',
    animationSpeed: 400,
});

变得 :

$('.mobileSelect').mobileSelect({
    animation: 'scale',
    animationSpeed: 400,
    onClose: function(){
        alert('onClose: '+$(this).val());
    },
    onOpen: function(){
        alert('onOpen: '+this.val());
    }
});

标签: jquery

解决方案


推荐阅读